Imported Upstream version 5.8.0.22

Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-10-19 20:04:20 +00:00
parent 5f4a27cc8a
commit 7d05485754
5020 changed files with 114082 additions and 186061 deletions

View File

@@ -15,9 +15,9 @@ namespace System.Security.Cryptography.Encryption.Tests.Asymmetric
public static void Ctor()
{
var transform = new IdentityTransform(1, 1, true);
Assert.Throws<ArgumentException>(() => new CryptoStream(new MemoryStream(), transform, (CryptoStreamMode)12345));
Assert.Throws<ArgumentException>(() => new CryptoStream(new MemoryStream(new byte[0], writable: false), transform, CryptoStreamMode.Write));
Assert.Throws<ArgumentException>(() => new CryptoStream(new CryptoStream(new MemoryStream(new byte[0]), transform, CryptoStreamMode.Write), transform, CryptoStreamMode.Read));
AssertExtensions.Throws<ArgumentException>(null, () => new CryptoStream(new MemoryStream(), transform, (CryptoStreamMode)12345));
AssertExtensions.Throws<ArgumentException>(null, "stream", () => new CryptoStream(new MemoryStream(new byte[0], writable: false), transform, CryptoStreamMode.Write));
AssertExtensions.Throws<ArgumentException>(null, "stream", () => new CryptoStream(new CryptoStream(new MemoryStream(new byte[0]), transform, CryptoStreamMode.Write), transform, CryptoStreamMode.Read));
}
[Theory]
@@ -51,7 +51,7 @@ namespace System.Security.Cryptography.Encryption.Tests.Asymmetric
Assert.Throws<ArgumentOutOfRangeException>(() => encryptStream.Write(new byte[0], -1, 0));
Assert.Throws<ArgumentOutOfRangeException>(() => encryptStream.Write(new byte[0], 0, -1));
Assert.Throws<ArgumentOutOfRangeException>(() => encryptStream.Write(new byte[0], 0, -1));
Assert.Throws<ArgumentException>(() => encryptStream.Write(new byte[3], 1, 4));
AssertExtensions.Throws<ArgumentException>(null, () => encryptStream.Write(new byte[3], 1, 4));
byte[] toWrite = Encoding.UTF8.GetBytes(LoremText);
@@ -104,7 +104,7 @@ namespace System.Security.Cryptography.Encryption.Tests.Asymmetric
Assert.Throws<ArgumentOutOfRangeException>(() => decryptStream.Read(new byte[0], -1, 0));
Assert.Throws<ArgumentOutOfRangeException>(() => decryptStream.Read(new byte[0], 0, -1));
Assert.Throws<ArgumentOutOfRangeException>(() => decryptStream.Read(new byte[0], 0, -1));
Assert.Throws<ArgumentException>(() => decryptStream.Read(new byte[3], 1, 4));
AssertExtensions.Throws<ArgumentException>(null, () => decryptStream.Read(new byte[3], 1, 4));
using (StreamReader reader = new StreamReader(decryptStream))
{

View File

@@ -122,9 +122,9 @@ namespace System.Security.Cryptography.Hashing.Tests
{
Assert.Throws<ArgumentNullException>(() => hash.ComputeHash((byte[])null, 0, 0));
Assert.Throws<ArgumentOutOfRangeException>(() => hash.ComputeHash(s_tenBytes, -1, 0));
Assert.Throws<ArgumentException>(() => hash.ComputeHash(s_tenBytes, 0, -1));
Assert.Throws<ArgumentException>(() => hash.ComputeHash(s_tenBytes, 0, 11));
Assert.Throws<ArgumentException>(() => hash.ComputeHash(s_tenBytes, 9, 2));
AssertExtensions.Throws<ArgumentException>(null, () => hash.ComputeHash(s_tenBytes, 0, -1));
AssertExtensions.Throws<ArgumentException>(null, () => hash.ComputeHash(s_tenBytes, 0, 11));
AssertExtensions.Throws<ArgumentException>(null, () => hash.ComputeHash(s_tenBytes, 9, 2));
hash.Dispose();