From b305fec4312575143dc8c83bea6ab65e0cb03f26 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Mon, 6 Apr 2020 23:46:28 +0700 Subject: Newer .NET versions append the parameter name --- crypto/test/src/asn1/test/ASN1IntegerTest.cs | 33 ++++++++++++++++++---------- 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'crypto') diff --git a/crypto/test/src/asn1/test/ASN1IntegerTest.cs b/crypto/test/src/asn1/test/ASN1IntegerTest.cs index 35366ea96..689a60ac5 100644 --- a/crypto/test/src/asn1/test/ASN1IntegerTest.cs +++ b/crypto/test/src/asn1/test/ASN1IntegerTest.cs @@ -60,7 +60,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed integer", e.Message); + CheckArgumentException(e, "malformed integer"); } // No support for thread-local override in C# version @@ -78,7 +78,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("test 1", "failed to construct sequence from byte[]: corrupted stream detected", e.Message); + CheckArgumentException("test 1", e, "failed to construct sequence from byte[]: corrupted stream detected"); } try @@ -89,7 +89,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed integer", e.Message); + CheckArgumentException(e, "malformed integer"); } try @@ -100,7 +100,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed enumerated", e.Message); + CheckArgumentException(e, "malformed enumerated"); } try @@ -111,7 +111,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed enumerated", e.Message); + CheckArgumentException(e, "malformed enumerated"); } #endif } @@ -173,7 +173,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed integer", e.Message); + CheckArgumentException(e, "malformed integer"); } } @@ -189,7 +189,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed integer", e.Message); + CheckArgumentException(e, "malformed integer"); } } @@ -209,7 +209,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed integer", e.Message); + CheckArgumentException(e, "malformed integer"); } } @@ -228,7 +228,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed integer", e.Message); + CheckArgumentException(e, "malformed integer"); } } @@ -251,7 +251,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed integer", e.Message); + CheckArgumentException(e, "malformed integer"); } } @@ -270,7 +270,7 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed integer", e.Message); + CheckArgumentException(e, "malformed integer"); } } */ @@ -336,9 +336,18 @@ namespace Org.BouncyCastle.Asn1.Tests } catch (ArgumentException e) { - IsEquals("malformed integer", e.Message); + CheckArgumentException(e, "malformed integer"); } } + private void CheckArgumentException(ArgumentException e, String expectedMessage) + { + IsTrue(e.Message.StartsWith(expectedMessage)); + } + + private void CheckArgumentException(String errorText, ArgumentException e, String expectedMessage) + { + IsTrue(errorText, e.Message.StartsWith(expectedMessage)); + } private void SetAllowUnsafeProperty(bool allowUnsafe) { -- cgit 1.4.1