diff options
author | Daniel Harvey <dharvey@microsoft.com> | 2017-04-18 19:52:02 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-18 19:52:02 +0300 |
commit | b43b4df2e0e2182154bb0f425cb4a61bc1269828 (patch) | |
tree | 0542a70918ed2276e68091b6ec724e09e040c1de /src/System.Security.Cryptography.Encoding | |
parent | f61b464b62939e8ab8361d41a78ecf21304a42ed (diff) |
Bulk updates of tests for AssertExtensions (#18491)
Bulk update to AssertExtensions.Throws for AOT support. This doesn't disable Assert.Throws.
Diffstat (limited to 'src/System.Security.Cryptography.Encoding')
-rw-r--r-- | src/System.Security.Cryptography.Encoding/tests/Base64TransformsTests.cs | 16 | ||||
-rw-r--r-- | src/System.Security.Cryptography.Encoding/tests/System.Security.Cryptography.Encoding.Tests.csproj | 3 |
2 files changed, 11 insertions, 8 deletions
diff --git a/src/System.Security.Cryptography.Encoding/tests/Base64TransformsTests.cs b/src/System.Security.Cryptography.Encoding/tests/Base64TransformsTests.cs index c7ced87de5..37fde07d3b 100644 --- a/src/System.Security.Cryptography.Encoding/tests/Base64TransformsTests.cs +++ b/src/System.Security.Cryptography.Encoding/tests/Base64TransformsTests.cs @@ -53,7 +53,7 @@ namespace System.Security.Cryptography.Encoding.Tests InvalidInput_Base64Transform(transform); // These exceptions only thrown in ToBase - Assert.Throws<ArgumentOutOfRangeException>("offsetOut", () => transform.TransformFinalBlock(data_5bytes, 0, 5)); + AssertExtensions.Throws<ArgumentOutOfRangeException>("offsetOut", () => transform.TransformFinalBlock(data_5bytes, 0, 5)); } } @@ -75,15 +75,15 @@ namespace System.Security.Cryptography.Encoding.Tests { byte[] data_4bytes = Text.Encoding.ASCII.GetBytes("aaaa"); - Assert.Throws<ArgumentNullException>("inputBuffer", () => transform.TransformBlock(null, 0, 0, null, 0)); - Assert.Throws<ArgumentOutOfRangeException>("inputOffset", () => transform.TransformBlock(Array.Empty<byte>(), -1, 0, null, 0)); - Assert.Throws<ArgumentNullException>("dst", () => transform.TransformBlock(data_4bytes, 0, 4, null, 0)); + AssertExtensions.Throws<ArgumentNullException>("inputBuffer", () => transform.TransformBlock(null, 0, 0, null, 0)); + AssertExtensions.Throws<ArgumentOutOfRangeException>("inputOffset", () => transform.TransformBlock(Array.Empty<byte>(), -1, 0, null, 0)); + AssertExtensions.Throws<ArgumentNullException>("dst", () => transform.TransformBlock(data_4bytes, 0, 4, null, 0)); Assert.Throws<ArgumentException>(null, () => transform.TransformBlock(Array.Empty<byte>(), 0, 1, null, 0)); Assert.Throws<ArgumentException>(null, () => transform.TransformBlock(Array.Empty<byte>(), 1, 0, null, 0)); - Assert.Throws<ArgumentNullException>("inputBuffer", () => transform.TransformFinalBlock(null, 0, 0)); - Assert.Throws<ArgumentOutOfRangeException>("inputOffset", () => transform.TransformFinalBlock(Array.Empty<byte>(), -1, 0)); - Assert.Throws<ArgumentOutOfRangeException>("inputOffset", () => transform.TransformFinalBlock(Array.Empty<byte>(), -1, 0)); + AssertExtensions.Throws<ArgumentNullException>("inputBuffer", () => transform.TransformFinalBlock(null, 0, 0)); + AssertExtensions.Throws<ArgumentOutOfRangeException>("inputOffset", () => transform.TransformFinalBlock(Array.Empty<byte>(), -1, 0)); + AssertExtensions.Throws<ArgumentOutOfRangeException>("inputOffset", () => transform.TransformFinalBlock(Array.Empty<byte>(), -1, 0)); Assert.Throws<ArgumentException>(null, () => transform.TransformFinalBlock(Array.Empty<byte>(), 1, 0)); } @@ -128,7 +128,7 @@ namespace System.Security.Cryptography.Encoding.Tests Assert.True(inputBytes.Length > 4); // Test passing blocks > 4 characters to TransformFinalBlock (not supported) - Assert.Throws<ArgumentOutOfRangeException>("offsetOut", () => transform.TransformFinalBlock(inputBytes, 0, inputBytes.Length)); + AssertExtensions.Throws<ArgumentOutOfRangeException>("offsetOut", () => transform.TransformFinalBlock(inputBytes, 0, inputBytes.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 af0e73e9d1..186fd923b6 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 @@ -23,6 +23,9 @@ <Compile Include="$(CommonPath)\System\Security\Cryptography\DerSequenceReader.cs"> <Link>Common\System\Security\Cryptography\DerSequenceReader.cs</Link> </Compile> + <Compile Include="$(CommonTestPath)\System\AssertExtensions.cs"> + <Link>Common\System\AssertExtensions.cs</Link> + </Compile> <Compile Include="$(CommonTestPath)\System\Security\Cryptography\ByteUtils.cs"> <Link>CommonTest\System\Security\Cryptography\ByteUtils.cs</Link> </Compile> |