Imported Upstream version 5.2.0.175

Former-commit-id: bb0468d0f257ff100aa895eb5fe583fb5dfbf900
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-06-07 13:16:24 +00:00
parent 4bdbaf4a88
commit 966bba02bb
8776 changed files with 346420 additions and 149650 deletions

View File

@@ -197,7 +197,7 @@ namespace System.IO.Tests
mstr = new MemoryStream();
dw2 = new BinaryWriter(mstr);
dw2.Write("0123456789".ToCharArray());
lReturn = dw2.Seek(4, SeekOrigin.End); //This wont throw any exception now.
lReturn = dw2.Seek(4, SeekOrigin.End); //This won't throw any exception now.
Assert.Equal(14, mstr.Position);
@@ -209,7 +209,7 @@ namespace System.IO.Tests
mstr = new MemoryStream();
dw2 = new BinaryWriter(mstr);
dw2.Write("0123456789".ToCharArray());
lReturn = dw2.Seek(11, SeekOrigin.Begin); //This wont throw any exception now.
lReturn = dw2.Seek(11, SeekOrigin.Begin); //This won't throw any exception now.
Assert.Equal(11, mstr.Position);
@@ -316,7 +316,6 @@ namespace System.IO.Tests
}
}
#if netstandard17
[Fact]
public void BinaryWriter_CloseTests()
{
@@ -329,7 +328,6 @@ namespace System.IO.Tests
binaryWriter.Close();
}
}
#endif //netstandard17
[Fact]
public void BinaryWriter_DisposeTests_Negative()
@@ -342,7 +340,6 @@ namespace System.IO.Tests
}
}
#if netstandard17
[Fact]
public void BinaryWriter_CloseTests_Negative()
{
@@ -353,7 +350,6 @@ namespace System.IO.Tests
ValidateDisposedExceptions(binaryWriter);
}
}
#endif //netstandard17
private void ValidateDisposedExceptions(BinaryWriter binaryWriter)
{

View File

@@ -20,7 +20,7 @@ namespace System.IO.Tests
[Fact]
public async Task ConcurrentOperationsAreSerialized()
{
byte[] data = Enumerable.Range(0, 1000).Select(i => (byte)i).ToArray();
byte[] data = Enumerable.Range(0, 1000).Select(i => unchecked((byte)i)).ToArray();
var mcaos = new ManuallyReleaseAsyncOperationsStream();
var stream = new BufferedStream(mcaos, 1);

View File

@@ -2,7 +2,6 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netstandard1.5;
netcoreapp;
netstandard;
</BuildConfigurations>

View File

@@ -410,7 +410,7 @@ namespace System.IO.Tests
{
for (int i = 0; i < buffer.Length; i++)
{
buffer[i] = (byte)i;
buffer[i] = unchecked((byte)i);
}
return buffer;

View File

@@ -42,7 +42,7 @@ namespace System.IO.Tests
}
[Fact]
public async void AsyncIfCanSeekIsFalseLengthAndPositionShouldNotBeCalled()
public async Task AsyncIfCanSeekIsFalseLengthAndPositionShouldNotBeCalled()
{
var baseStream = new DelegateStream(
canReadFunc: () => true,
@@ -82,7 +82,7 @@ namespace System.IO.Tests
}
[Fact]
public async void AsyncIfCanSeekIsTrueLengthAndPositionShouldOnlyBeCalledOnce()
public async Task AsyncIfCanSeekIsTrueLengthAndPositionShouldOnlyBeCalledOnce()
{
var baseStream = new DelegateStream(
canReadFunc: () => true,
@@ -136,7 +136,7 @@ namespace System.IO.Tests
[Theory]
[MemberData(nameof(LengthIsLessThanOrEqualToPosition))]
public async void AsyncIfLengthIsLessThanOrEqualToPositionCopyToShouldStillBeCalledWithAPositiveBufferSize(long length, long position)
public async Task AsyncIfLengthIsLessThanOrEqualToPositionCopyToShouldStillBeCalledWithAPositiveBufferSize(long length, long position)
{
var baseStream = new DelegateStream(
canReadFunc: () => true,
@@ -191,7 +191,7 @@ namespace System.IO.Tests
[Theory]
[MemberData(nameof(LengthMinusPositionPositiveOverflows))]
public async void AsyncIfLengthMinusPositionPositiveOverflowsBufferSizeShouldStillBePositive(long length, long position)
public async Task AsyncIfLengthMinusPositionPositiveOverflowsBufferSizeShouldStillBePositive(long length, long position)
{
var baseStream = new DelegateStream(
canReadFunc: () => true,
@@ -270,7 +270,7 @@ namespace System.IO.Tests
[Theory]
[MemberData(nameof(LengthIsGreaterThanPositionAndDoesNotOverflow))]
public async void AsyncIfLengthIsGreaterThanPositionAndDoesNotOverflowEverythingShouldGoNormally(long length, long position)
public async Task AsyncIfLengthIsGreaterThanPositionAndDoesNotOverflowEverythingShouldGoNormally(long length, long position)
{
const int ReadLimit = 7;

View File

@@ -53,7 +53,7 @@ namespace System.IO.Tests
int length = 1 << 10; //fancy way of writing 2 to the pow 10
byte[] btArr = new byte[length];
for (int i = 0; i < btArr.Length; i++)
btArr[i] = (byte)i;
btArr[i] = unchecked((byte)i);
if (stream.CanWrite)
stream.Write(btArr, 0, btArr.Length);
@@ -118,11 +118,11 @@ namespace System.IO.Tests
stream.Seek(0, SeekOrigin.Begin);
for (int i = 0; i < iLength; i++)
stream.WriteByte((byte)i);
stream.WriteByte(unchecked((byte)i));
byte[] btArr = new byte[iLength];
for (int i = 0; i < iLength; i++)
btArr[i] = (byte)i;
btArr[i] = unchecked((byte)i);
stream.Write(btArr, 0, iLength);
//we will write many things here using a binary writer
@@ -168,7 +168,7 @@ namespace System.IO.Tests
stream.Read(btArr, 0, iLength);
for (int i = 0; i < iLength; i++)
{
Assert.Equal((byte)i, btArr[i]);
Assert.Equal(unchecked((byte)i), btArr[i]);
}
//Now, for the binary reader
@@ -221,14 +221,14 @@ namespace System.IO.Tests
btArr = new byte[iLength];
for (int i = 0; i < iLength; i++)
btArr[i] = (byte)(i + 5);
btArr[i] = unchecked((byte)(i + 5));
await stream.WriteAsync(btArr, 0, btArr.Length);
stream.Position = 0;
for (int i = 0; i < iLength; i++)
{
Assert.Equal((byte)(i + 5), stream.ReadByte());
Assert.Equal(unchecked((byte)(i + 5)), stream.ReadByte());
}
//we will read asynchronously
@@ -249,7 +249,7 @@ namespace System.IO.Tests
[Fact]
public async Task FlushAsyncTest()
{
byte[] data = Enumerable.Range(0, 8000).Select(i => (byte)i).ToArray();
byte[] data = Enumerable.Range(0, 8000).Select(i => unchecked((byte)i)).ToArray();
Stream stream = CreateStream();
for (int i = 0; i < 4; i++)

View File

@@ -27,7 +27,6 @@ namespace System.IO.Tests
ValidateDisposedExceptions(sw2);
}
#if netstandard17
[Fact]
public void AfterCloseThrows()
{
@@ -39,7 +38,6 @@ namespace System.IO.Tests
sw2.Close();
ValidateDisposedExceptions(sw2);
}
#endif //netstandard17
private void ValidateDisposedExceptions(StreamWriter sw)
{
@@ -80,7 +78,6 @@ namespace System.IO.Tests
Assert.Throws<ObjectDisposedException>(() => sw2.Flush());
}
#if netstandard17
[Fact]
public void CantFlushAfterClose()
{
@@ -93,6 +90,5 @@ namespace System.IO.Tests
sw2.Close();
Assert.Throws<ObjectDisposedException>(() => sw2.Flush());
}
#endif //netstandard17
}
}

View File

@@ -156,7 +156,6 @@ namespace System.IO.Tests
Assert.Equal(str1, sr.ReadToEnd());
}
#if netstandard17
[Fact]
public static void Closed_DisposedExceptions()
{
@@ -164,7 +163,6 @@ namespace System.IO.Tests
sr.Close();
ValidateDisposedExceptions(sr);
}
#endif //netstandard17
[Fact]
public static void Disposed_DisposedExceptions()

View File

@@ -235,7 +235,6 @@ namespace System.IO.Tests
Assert.Equal(sb.ToString(), sw.GetStringBuilder().ToString());
}
#if netstandard17
[Fact]
public static void Closed_DisposedExceptions()
{
@@ -243,7 +242,6 @@ namespace System.IO.Tests
sw.Close();
ValidateDisposedExceptions(sw);
}
#endif //netstandard17
[Fact]
public static void Disposed_DisposedExceptions()

View File

@@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<Project Include="System.IO.Tests.csproj" />
<Project Include="System.IO.Tests.csproj">
<TargetGroup>netstandard1.5</TargetGroup>
<TestTFMs>netcoreapp1.0</TestTFMs>
</Project>
<Project Include="System.IO.Tests.csproj">
<TargetGroup>netcoreapp</TargetGroup>
<TestTFMs>netcoreapp</TestTFMs>
</Project>
<Project Include="System.IO.Tests.csproj">
<OSGroup>Windows_NT</OSGroup>
<TestTFMs>net463</TestTFMs>
</Project>
<Project Include="System.IO.Tests.csproj">
<TargetGroup>netstandard1.5</TargetGroup>
<OSGroup>Windows_NT</OSGroup>
<TestTFMs>net462</TestTFMs>
</Project>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
@@ -7,13 +7,11 @@
<ProjectGuid>{492EC54D-D2C4-4B3F-AC1F-646B3F7EBB02}</ProjectGuid>
</PropertyGroup>
<!-- Default configurations to help VS understand the configurations -->
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.5-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.5-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Release|AnyCPU'" />
<ItemGroup Condition="'$(TargetGroup)'=='netstandard'">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netcoreapp-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="IndentedTextWriter.cs" />
<Compile Include="BinaryReader\BinaryReaderTests.cs" />
<Compile Include="MemoryStream\MemoryStream.GetBufferTests.cs" />
@@ -24,8 +22,6 @@
<Compile Include="StreamWriter\StreamWriter.StringCtorTests.cs" />
<Compile Include="Stream\Stream.APMMethodsTests.cs" />
<Compile Include="BufferedStream\BufferedStreamTests.netstandard.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="BinaryWriter\BinaryWriter.WriteByteCharTests.cs" />
<Compile Include="BinaryWriter\BinaryWriter.WriteTests.cs" />
<Compile Include="BinaryWriter\BinaryWriterTests.cs" />
@@ -63,4 +59,4 @@
</Compile>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>