Refactoring in Tls.Tests
5 files changed, 6 insertions, 11 deletions
diff --git a/crypto/test/src/tls/test/PskTls13ClientTest.cs b/crypto/test/src/tls/test/PskTls13ClientTest.cs
index 0850fca7d..07778f5d0 100644
--- a/crypto/test/src/tls/test/PskTls13ClientTest.cs
+++ b/crypto/test/src/tls/test/PskTls13ClientTest.cs
@@ -50,7 +50,7 @@ namespace Org.BouncyCastle.Tls.Tests
{
Console.WriteLine("<<< " + line);
- string upperLine = TlsTestUtilities.ToUpperInvariant(line);
+ string upperLine = line.ToUpperInvariant();
// TEST CODE ONLY. This is not a robust way of parsing the result!
foreach (string end in ends)
diff --git a/crypto/test/src/tls/test/PskTlsClientTest.cs b/crypto/test/src/tls/test/PskTlsClientTest.cs
index d3c13ccee..35c4a7aa5 100644
--- a/crypto/test/src/tls/test/PskTlsClientTest.cs
+++ b/crypto/test/src/tls/test/PskTlsClientTest.cs
@@ -78,7 +78,7 @@ namespace Org.BouncyCastle.Tls.Tests
{
Console.WriteLine("<<< " + line);
- string upperLine = TlsTestUtilities.ToUpperInvariant(line);
+ string upperLine = line.ToUpperInvariant();
// TEST CODE ONLY. This is not a robust way of parsing the result!
foreach (string end in ends)
diff --git a/crypto/test/src/tls/test/TlsClientRawKeysTest.cs b/crypto/test/src/tls/test/TlsClientRawKeysTest.cs
index 510213fc7..f607dba04 100644
--- a/crypto/test/src/tls/test/TlsClientRawKeysTest.cs
+++ b/crypto/test/src/tls/test/TlsClientRawKeysTest.cs
@@ -64,7 +64,7 @@ namespace Org.BouncyCastle.Tls.Tests
{
Console.WriteLine("<<< " + line);
- string upperLine = TlsTestUtilities.ToUpperInvariant(line);
+ string upperLine = line.ToUpperInvariant();
// TEST CODE ONLY. This is not a robust way of parsing the result!
foreach (string end in ends)
diff --git a/crypto/test/src/tls/test/TlsClientTest.cs b/crypto/test/src/tls/test/TlsClientTest.cs
index 65adc5dd7..eaf2ad8e2 100644
--- a/crypto/test/src/tls/test/TlsClientTest.cs
+++ b/crypto/test/src/tls/test/TlsClientTest.cs
@@ -62,7 +62,7 @@ namespace Org.BouncyCastle.Tls.Tests
{
Console.WriteLine("<<< " + line);
- string upperLine = TlsTestUtilities.ToUpperInvariant(line);
+ string upperLine = line.ToUpperInvariant();
// TEST CODE ONLY. This is not a robust way of parsing the result!
foreach (string end in ends)
diff --git a/crypto/test/src/tls/test/TlsTestUtilities.cs b/crypto/test/src/tls/test/TlsTestUtilities.cs
index 3baf233c7..789a5b513 100644
--- a/crypto/test/src/tls/test/TlsTestUtilities.cs
+++ b/crypto/test/src/tls/test/TlsTestUtilities.cs
@@ -46,12 +46,7 @@ namespace Org.BouncyCastle.Tls.Tests
internal static bool EqualsIgnoreCase(string a, string b)
{
- return ToUpperInvariant(a) == ToUpperInvariant(b);
- }
-
- internal static string ToUpperInvariant(string s)
- {
- return s.ToUpper(CultureInfo.InvariantCulture);
+ return string.Equals(a, b, StringComparison.InvariantCultureIgnoreCase);
}
internal static string Fingerprint(X509CertificateStructure c)
@@ -59,7 +54,7 @@ namespace Org.BouncyCastle.Tls.Tests
byte[] der = c.GetEncoded();
byte[] hash = Sha256DigestOf(der);
byte[] hexBytes = Hex.Encode(hash);
- string hex = ToUpperInvariant(Encoding.ASCII.GetString(hexBytes));
+ string hex = Encoding.ASCII.GetString(hexBytes).ToUpperInvariant();
StringBuilder fp = new StringBuilder();
int i = 0;
|