You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -122,7 +122,7 @@ namespace System.Security.Cryptography.Encoding.Tests
|
||||
AsnEncodedData[] a = new AsnEncodedData[3];
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => c.CopyTo(a, -1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => c.CopyTo(a, 3));
|
||||
Assert.Throws<ArgumentException>(() => c.CopyTo(a, 1));
|
||||
AssertExtensions.Throws<ArgumentException>("destinationArray", null, () => c.CopyTo(a, 1));
|
||||
|
||||
if (PlatformDetection.IsNonZeroLowerBoundArraySupported)
|
||||
{
|
||||
|
||||
@@ -78,13 +78,13 @@ namespace System.Security.Cryptography.Encoding.Tests
|
||||
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));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => transform.TransformBlock(Array.Empty<byte>(), 0, 1, null, 0));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => transform.TransformBlock(Array.Empty<byte>(), 1, 0, null, 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));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => transform.TransformFinalBlock(Array.Empty<byte>(), 1, 0));
|
||||
}
|
||||
|
||||
[Theory, MemberData(nameof(TestData_Ascii))]
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace System.Security.Cryptography.Encoding.Tests
|
||||
[Fact]
|
||||
public void CopyTo_Throws()
|
||||
{
|
||||
ValidateCopyToThrows((collection, array, index) => collection.CopyTo(array, index));
|
||||
ValidateCopyToThrows((collection, array, index) => collection.CopyTo(array, index), paramName: "destinationArray");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -102,14 +102,15 @@ namespace System.Security.Cryptography.Encoding.Tests
|
||||
ValidateCopyToThrows((collection, array, index) => ((ICollection)collection).CopyTo(array, index), c =>
|
||||
{
|
||||
ICollection ic = c;
|
||||
Assert.Throws<ArgumentException>(() => ic.CopyTo(new Oid[4, 3], 0));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => ic.CopyTo(new Oid[4, 3], 0));
|
||||
Assert.Throws<InvalidCastException>(() => ic.CopyTo(new string[10], 0));
|
||||
});
|
||||
}, paramName: null);
|
||||
}
|
||||
|
||||
private static void ValidateCopyToThrows(
|
||||
Action<OidCollection, Oid[], int> copyTo,
|
||||
Action<OidCollection> additionalValidation = null)
|
||||
Action<OidCollection> additionalValidation = null,
|
||||
string paramName = null)
|
||||
{
|
||||
var item1 = new Oid(Sha1Oid, Sha1Name);
|
||||
var item2 = new Oid(Sha256Oid, Sha256Name);
|
||||
@@ -121,7 +122,7 @@ namespace System.Security.Cryptography.Encoding.Tests
|
||||
Assert.Throws<ArgumentNullException>(() => copyTo(c, null, 0));
|
||||
Assert.Throws<ArgumentNullException>(() => copyTo(c, null, -1));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => copyTo(c, new Oid[10], -1));
|
||||
Assert.Throws<ArgumentException>(() => copyTo(c, new Oid[10], 7));
|
||||
AssertExtensions.Throws<ArgumentException>(paramName, null, () => copyTo(c, new Oid[10], 7));
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => copyTo(c, new Oid[10], 1000));
|
||||
|
||||
additionalValidation?.Invoke(c);
|
||||
|
||||
@@ -23,9 +23,6 @@
|
||||
<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\PlatformDetection.cs">
|
||||
<Link>Common\System\PlatformDetection.cs</Link>
|
||||
</Compile>
|
||||
|
||||
Reference in New Issue
Block a user