diff options
author | Ahson Khan <ahkha@microsoft.com> | 2018-04-10 22:55:23 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-10 22:55:23 +0300 |
commit | b1be36212902ca61c4170ae2342b6148f79be22f (patch) | |
tree | 1fa5498896f45a07374b843f5e4678d7d90b8703 /src/System.Security.Cryptography.Encoding/tests | |
parent | 385286a5465658794bd03049ad1557597b53ca0e (diff) |
Fix TODO to cleanup Tests by removing AsReadOnySpan/Memory and update callsites (#28962)
Diffstat (limited to 'src/System.Security.Cryptography.Encoding/tests')
8 files changed, 11 insertions, 12 deletions
diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBMPString.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBMPString.cs index dbf647f48d..3eb40a428b 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBMPString.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBMPString.cs @@ -542,7 +542,7 @@ namespace System.Security.Cryptography.Tests.Asn1 Assert.Equal(1000, bytesWritten); Assert.Equal( - input.AsReadOnlySpan().Slice(4).ByteArrayToHex(), + input.AsSpan().Slice(4).ByteArrayToHex(), output.ByteArrayToHex()); } diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBitString.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBitString.cs index 7d4bae41d3..4230b1d1bd 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBitString.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadBitString.cs @@ -247,7 +247,7 @@ namespace System.Security.Cryptography.Tests.Asn1 Assert.True(didRead, "reader.TryCopyBitStringBytes"); Assert.Equal(expectedUnusedBitCount, unusedBitCount); - Assert.Equal(expectedHex, output.AsReadOnlySpan().Slice(0, bytesWritten).ByteArrayToHex()); + Assert.Equal(expectedHex, output.AsSpan().Slice(0, bytesWritten).ByteArrayToHex()); } private static void TryCopyBitStringBytes_Throws( @@ -453,7 +453,7 @@ namespace System.Security.Cryptography.Tests.Asn1 Assert.Equal(999, bytesWritten); Assert.Equal( - input.AsReadOnlySpan().Slice(5).ByteArrayToHex(), + input.AsSpan().Slice(5).ByteArrayToHex(), output.ByteArrayToHex()); } diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadIA5String.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadIA5String.cs index 8a4e24f77b..5d3d285a42 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadIA5String.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadIA5String.cs @@ -506,7 +506,7 @@ namespace System.Security.Cryptography.Tests.Asn1 Assert.Equal(1000, bytesWritten); Assert.Equal( - input.AsReadOnlySpan().Slice(4).ByteArrayToHex(), + input.AsSpan().Slice(4).ByteArrayToHex(), output.ByteArrayToHex()); } diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadOctetString.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadOctetString.cs index 2283f4f95a..f9ff4d4f7d 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadOctetString.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadOctetString.cs @@ -204,7 +204,7 @@ namespace System.Security.Cryptography.Tests.Asn1 out int bytesWritten); Assert.True(didRead, "reader.TryCopyOctetStringBytes"); - Assert.Equal(expectedHex, output.AsReadOnlySpan().Slice(0, bytesWritten).ByteArrayToHex()); + Assert.Equal(expectedHex, output.AsSpan().Slice(0, bytesWritten).ByteArrayToHex()); } private static void TryCopyOctetStringBytes_Throws( @@ -359,7 +359,7 @@ namespace System.Security.Cryptography.Tests.Asn1 Assert.Equal(1000, bytesWritten); Assert.Equal( - input.AsReadOnlySpan().Slice(4).ByteArrayToHex(), + input.AsSpan().Slice(4).ByteArrayToHex(), output.ByteArrayToHex()); } diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadUTF8String.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadUTF8String.cs index 6348c987b5..f441405c5b 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadUTF8String.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Reader/ReadUTF8String.cs @@ -522,7 +522,7 @@ namespace System.Security.Cryptography.Tests.Asn1 Assert.Equal(1000, bytesWritten); Assert.Equal( - input.AsReadOnlySpan().Slice(4).ByteArrayToHex(), + input.AsSpan().Slice(4).ByteArrayToHex(), output.ByteArrayToHex()); } diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/ComprehensiveWriteTest.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/ComprehensiveWriteTest.cs index 157e19830d..cb524dfd1d 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/ComprehensiveWriteTest.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/ComprehensiveWriteTest.cs @@ -266,7 +266,7 @@ namespace System.Security.Cryptography.Tests.Asn1 "C058767D1FF060A609D7E3D4317079AF0CD0A8A49251AB129157F9894A036487" + "090807060504030201").HexToByteArray(); - writer.WriteBitString(containsSignature.AsReadOnlySpan().Slice(9, 256)); + writer.WriteBitString(containsSignature.AsSpan().Slice(9, 256)); // certificate writer.PopSequence(); diff --git a/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/WriteCharacterString.cs b/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/WriteCharacterString.cs index 67584074d7..6d1f4d9cf4 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/WriteCharacterString.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Asn1/Writer/WriteCharacterString.cs @@ -372,8 +372,8 @@ namespace System.Security.Cryptography.Tests.Asn1 byte[] encoded = writer.Encode(); - Assert.Equal(tagHex, encoded.AsReadOnlySpan().Slice(0, tagHex.Length / 2).ByteArrayToHex()); - Assert.Equal("0000", encoded.AsReadOnlySpan().Slice(encoded.Length - 2).ByteArrayToHex()); + Assert.Equal(tagHex, encoded.AsSpan().Slice(0, tagHex.Length / 2).ByteArrayToHex()); + Assert.Equal("0000", encoded.AsSpan().Slice(encoded.Length - 2).ByteArrayToHex()); Assert.Equal(encodedSize, encoded.Length); } diff --git a/src/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj b/src/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj index 51ad291d9b..51a3030ad6 100644 --- a/src/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj +++ b/src/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj @@ -59,7 +59,6 @@ <Compile Include="DerSequenceReaderTests.cs" /> <Compile Include="Oid.cs" /> <Compile Include="OidCollectionTests.cs" /> - <Compile Include="TestHelpers.cs" /> <Compile Include="$(CommonPath)\System\Security\Cryptography\Asn1V2.cs"> <Link>Common\System\Security\Cryptography\Asn1V2.cs</Link> </Compile> @@ -83,4 +82,4 @@ </Compile> </ItemGroup> <Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" /> -</Project> +</Project>
\ No newline at end of file |