diff --git a/tests/Formatting/NSecTests.cs b/tests/Formatting/NSecTests.cs index e8fff51a..4b26a513 100644 --- a/tests/Formatting/NSecTests.cs +++ b/tests/Formatting/NSecTests.cs @@ -87,7 +87,7 @@ private static void Test(Algorithm a, int seedSize, KeyBlobFormat importFormat, Assert.NotNull(blob); Assert.Equal(blobHeader.Length + sizeof(short) + sizeof(short) + keySize, blob.Length); - Assert.Equal(blobHeader, blob.AsSpan(0, blobHeader.Length).ToArray()); + Assert.Equal(blobHeader, blob[..blobHeader.Length]); Assert.Equal(keySize, BitConverter.ToInt16(blob, blobHeader.Length)); Assert.Equal(outputSize, BitConverter.ToInt16(blob, blobHeader.Length + sizeof(short))); @@ -118,7 +118,7 @@ public static void TestSharedSecret() Assert.NotNull(blob); Assert.Equal(blobHeader.Length + sizeof(short) + sizeof(short) + b.Length, blob.Length); - Assert.Equal(blobHeader, blob.AsSpan(0, blobHeader.Length).ToArray()); + Assert.Equal(blobHeader, blob[..blobHeader.Length]); Assert.Equal(b.Length, BitConverter.ToInt16(blob, blobHeader.Length)); Assert.Equal(0, BitConverter.ToInt16(blob, blobHeader.Length + sizeof(short))); diff --git a/tests/Other/Iso78164PaddingTests.cs b/tests/Other/Iso78164PaddingTests.cs index 28edc1c7..321f3cfa 100644 --- a/tests/Other/Iso78164PaddingTests.cs +++ b/tests/Other/Iso78164PaddingTests.cs @@ -70,7 +70,7 @@ public static void DecodeCorruptedPadding(int blockSize, byte[] padded, byte[] u { for (var i = unpadded.Length; i < padded.Length; i++) { - var corrupted = padded.AsSpan().ToArray(); + var corrupted = padded[..]; corrupted[i] = 0xFF; Assert.Null(Iso78164Padding.Unpad(corrupted, blockSize)); Assert.False(Iso78164Padding.Unpad(corrupted, blockSize, out var actual)); @@ -84,7 +84,7 @@ public static void DecodeInvalidLength(int blockSize, byte[] padded, byte[] unpa { for (var i = 1; i < blockSize; i++) { - var corrupted = padded.AsSpan(0, padded.Length - i).ToArray(); + var corrupted = padded[..^i]; Assert.Null(Iso78164Padding.Unpad(corrupted, blockSize)); Assert.False(Iso78164Padding.Unpad(corrupted, blockSize, out var actual)); Assert.True(actual.IsEmpty);