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

@@ -53,7 +53,7 @@ namespace System.IO.Tests
AssertExtensions.Throws<ArgumentNullException>("array", () => stream.Read(null, 1, 1));
Assert.Throws<ArgumentOutOfRangeException>(() => stream.Read(array, -1, 1));
Assert.Throws<ArgumentOutOfRangeException>(() => stream.Read(array, 1, -1));
Assert.Throws<ArgumentException>(() => stream.Read(array, 9, 2));
AssertExtensions.Throws<ArgumentException>(null, () => stream.Read(array, 9, 2));
}
}
@@ -66,7 +66,7 @@ namespace System.IO.Tests
AssertExtensions.Throws<ArgumentNullException>("array", () => stream.Write(null, 1, 1));
Assert.Throws<ArgumentOutOfRangeException>(() => stream.Write(array, -1, 1));
Assert.Throws<ArgumentOutOfRangeException>(() => stream.Write(array, 1, -1));
Assert.Throws<ArgumentException>(() => stream.Write(array, 9, 2));
AssertExtensions.Throws<ArgumentException>(null, () => stream.Write(array, 9, 2));
}
}

View File

@@ -113,6 +113,20 @@ namespace System.IO.Tests
{
return new BufferedStream(new MemoryStream(), bufferSize);
}
[Fact]
public void ReadByte_ThenRead_EndOfStreamCorrectlyFound()
{
using (var s = new BufferedStream(new MemoryStream(new byte[] { 1, 2 }), 2))
{
Assert.Equal(1, s.ReadByte());
Assert.Equal(2, s.ReadByte());
Assert.Equal(-1, s.ReadByte());
Assert.Equal(0, s.Read(new byte[1], 0, 1));
Assert.Equal(0, s.Read(new byte[1], 0, 1));
}
}
}
public class BufferedStream_TestLeaveOpen : TestLeaveOpen