Bump test projects up to .NET 4.5.2

- aspnet/Testing#248
- xUnit no longer supports .NET 4.5.1
- build tests for desktop .NET only on Windows
This commit is contained in:
Doug Bunting 2017-02-14 09:21:44 -08:00
parent 796a408be7
commit be9f83b308
6 changed files with 12 additions and 10 deletions

View File

@ -3,7 +3,8 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks> <TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks>
<!-- TODO remove rid when https://github.com/dotnet/sdk/issues/396 is resolved --> <!-- TODO remove rid when https://github.com/dotnet/sdk/issues/396 is resolved -->
<RuntimeIdentifier Condition="'$(TargetFramework)'!='netcoreapp1.1'">win7-x64</RuntimeIdentifier> <RuntimeIdentifier Condition="'$(TargetFramework)'!='netcoreapp1.1'">win7-x64</RuntimeIdentifier>
</PropertyGroup> </PropertyGroup>
@ -26,7 +27,7 @@
<PackageReference Include="Microsoft.CodeCoverage" Version="1.0.2" PrivateAssets="All" /> <PackageReference Include="Microsoft.CodeCoverage" Version="1.0.2" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' "> <ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>

View File

@ -83,7 +83,7 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
await Assert.ThrowsAsync<NotSupportedException>(() => stream.WriteAsync(new byte[1], 0, 1)); await Assert.ThrowsAsync<NotSupportedException>(() => stream.WriteAsync(new byte[1], 0, 1));
} }
#if NET451 #if NET452
[Fact] [Fact]
public void BeginWriteThrows() public void BeginWriteThrows()
{ {

View File

@ -54,7 +54,7 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
await Assert.ThrowsAsync<NotSupportedException>(() => stream.ReadAsync(new byte[1], 0, 1)); await Assert.ThrowsAsync<NotSupportedException>(() => stream.ReadAsync(new byte[1], 0, 1));
} }
#if NET451 #if NET452
[Fact] [Fact]
public void BeginReadThrows() public void BeginReadThrows()
{ {

View File

@ -3,7 +3,8 @@
<Import Project="..\..\build\common.props" /> <Import Project="..\..\build\common.props" />
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp1.1;net451</TargetFrameworks> <TargetFrameworks>netcoreapp1.1;net452</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp1.1</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- TODO remove rid when https://github.com/dotnet/sdk/issues/396 is resolved --> <!-- TODO remove rid when https://github.com/dotnet/sdk/issues/396 is resolved -->
<RuntimeIdentifier Condition="'$(TargetFramework)'!='netcoreapp1.1'">win7-x64</RuntimeIdentifier> <RuntimeIdentifier Condition="'$(TargetFramework)'!='netcoreapp1.1'">win7-x64</RuntimeIdentifier>
@ -24,7 +25,7 @@
<PackageReference Include="Microsoft.CodeCoverage" Version="1.0.2" PrivateAssets="All" /> <PackageReference Include="Microsoft.CodeCoverage" Version="1.0.2" PrivateAssets="All" />
</ItemGroup> </ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net451' "> <ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>

View File

@ -131,7 +131,7 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
var t = Task.Run(async () => var t = Task.Run(async () =>
{ {
var socket = TestConnection.CreateConnectedLoopbackSocket(port); var socket = TestConnection.CreateConnectedLoopbackSocket(port);
#if NET451 #if NET452
await Task.Factory.FromAsync( await Task.Factory.FromAsync(
socket.BeginSend, socket.BeginSend,
socket.EndSend, socket.EndSend,
@ -205,7 +205,7 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
var t = Task.Run(async () => var t = Task.Run(async () =>
{ {
var socket = TestConnection.CreateConnectedLoopbackSocket(port); var socket = TestConnection.CreateConnectedLoopbackSocket(port);
#if NET451 #if NET452
await Task.Factory.FromAsync( await Task.Factory.FromAsync(
socket.BeginSend, socket.BeginSend,
socket.EndSend, socket.EndSend,
@ -221,7 +221,7 @@ namespace Microsoft.AspNetCore.Server.KestrelTests
var buffer = new ArraySegment<byte>(new byte[2048]); var buffer = new ArraySegment<byte>(new byte[2048]);
while (true) while (true)
{ {
#if NET451 #if NET452
var count = await Task.Factory.FromAsync( var count = await Task.Factory.FromAsync(
socket.BeginReceive, socket.BeginReceive,
socket.EndReceive, socket.EndReceive,

View File

@ -9,7 +9,7 @@ namespace Microsoft.AspNetCore.Testing
public static class TestResources public static class TestResources
{ {
private static readonly string _testCertificatePath = private static readonly string _testCertificatePath =
#if NET451 #if NET452
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testCert.pfx"); Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "testCert.pfx");
#else #else
Path.Combine(AppContext.BaseDirectory, "testCert.pfx"); Path.Combine(AppContext.BaseDirectory, "testCert.pfx");