Update samples and tests to target netcoreapp2.1

This commit is contained in:
Pranav K 2017-11-14 10:07:10 -08:00
parent 936f82874a
commit 58fb4f322e
12 changed files with 27 additions and 18 deletions

View File

@ -1,4 +1,8 @@
<Project> <Project>
<Import
Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))\AspNetCoreSettings.props"
Condition=" '$(CI)' != 'true' AND '$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), AspNetCoreSettings.props))' != '' " />
<Import Project="version.props" /> <Import Project="version.props" />
<Import Project="build\dependencies.props" /> <Import Project="build\dependencies.props" />

View File

@ -1,2 +1,2 @@
version:2.1.0-preview1-15549 version:2.1.0-preview1-15567
commithash:f570e08585fec510dd60cd4bfe8795388b757a95 commithash:903e3104807b1bb8cddd28bdef205b1e2dc021d1

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<ServerGarbageCollection>true</ServerGarbageCollection> <ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup> </PropertyGroup>

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFrameworks>netcoreapp2.1;net461</TargetFrameworks>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<ServerGarbageCollection>true</ServerGarbageCollection> <ServerGarbageCollection>true</ServerGarbageCollection>
</PropertyGroup> </PropertyGroup>

View File

@ -1,6 +1,13 @@
<Project> <Project>
<Import Project="..\Directory.Build.props" /> <Import Project="..\Directory.Build.props" />
<PropertyGroup>
<DeveloperBuildTestTfms>netcoreapp2.1</DeveloperBuildTestTfms>
<StandardTestTfms>$(DeveloperBuildTestTfms)</StandardTestTfms>
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' ">$(StandardTestTfms);netcoreapp2.0</StandardTestTfms>
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(StandardTestTfms);net461</StandardTestTfms>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" /> <PackageReference Include="Internal.AspNetCore.Sdk" PrivateAssets="All" Version="$(InternalAspNetCoreSdkPackageVersion)" />
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" /> <PackageReference Include="Microsoft.AspNetCore.Testing" Version="$(MicrosoftAspNetCoreTestingPackageVersion)" />

View File

@ -168,7 +168,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
context = await server.AcceptAsync(Utilities.DefaultTimeout); context = await server.AcceptAsync(Utilities.DefaultTimeout);
context.Response.Headers["Content-lenGth"] = " 20 "; context.Response.Headers["Content-lenGth"] = " 20 ";
context.Dispose(); context.Dispose();
#elif NETCOREAPP2_0 #elif NETCOREAPP2_0 || NETCOREAPP2_1
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif
@ -330,7 +330,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
writeTask = context.Response.Body.WriteAsync(new byte[10], 0, 10, cts.Token); writeTask = context.Response.Body.WriteAsync(new byte[10], 0, 10, cts.Token);
Assert.True(writeTask.IsCanceled); Assert.True(writeTask.IsCanceled);
context.Dispose(); context.Dispose();
#elif NETCOREAPP2_0 #elif NETCOREAPP2_0 || NETCOREAPP2_1
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif
@ -362,7 +362,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
writeTask = context.Response.Body.WriteAsync(new byte[10], 0, 10, cts.Token); writeTask = context.Response.Body.WriteAsync(new byte[10], 0, 10, cts.Token);
Assert.True(writeTask.IsCanceled); Assert.True(writeTask.IsCanceled);
context.Dispose(); context.Dispose();
#elif NETCOREAPP2_0 #elif NETCOREAPP2_0 || NETCOREAPP2_1
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif

View File

@ -252,7 +252,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.Equal(0, response.ContentLength); Assert.Equal(0, response.ContentLength);
Assert.NotNull(response.Headers["Date"]); Assert.NotNull(response.Headers["Date"]);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
#if NETCOREAPP2_0 // WebHeaderCollection.GetValues() not available in CoreCLR. #if NETCOREAPP2_0 || NETCOREAPP2_1 // WebHeaderCollection.GetValues() not available in CoreCLR.
Assert.Equal("custom1, and custom2, custom3", response.Headers["WWW-Authenticate"]); Assert.Equal("custom1, and custom2, custom3", response.Headers["WWW-Authenticate"]);
#elif NET461 #elif NET461
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("WWW-Authenticate")); Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("WWW-Authenticate"));
@ -283,7 +283,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
Assert.Equal(0, response.ContentLength); Assert.Equal(0, response.ContentLength);
Assert.NotNull(response.Headers["Date"]); Assert.NotNull(response.Headers["Date"]);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
#if NETCOREAPP2_0 // WebHeaderCollection.GetValues() not available in CoreCLR. #if NETCOREAPP2_0 || NETCOREAPP2_1 // WebHeaderCollection.GetValues() not available in CoreCLR.
Assert.Equal("custom1, and custom2, custom3", response.Headers["Custom-Header1"]); Assert.Equal("custom1, and custom2, custom3", response.Headers["Custom-Header1"]);
#elif NET461 #elif NET461
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("Custom-Header1")); Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("Custom-Header1"));

View File

@ -371,7 +371,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
writeTask = context.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token); writeTask = context.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
Assert.True(writeTask.IsCanceled); Assert.True(writeTask.IsCanceled);
context.Dispose(); context.Dispose();
#elif NETCOREAPP2_0 #elif NETCOREAPP2_0 || NETCOREAPP2_1
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif
@ -403,7 +403,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
writeTask = context.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token); writeTask = context.Response.SendFileAsync(AbsoluteFilePath, 0, null, cts.Token);
Assert.True(writeTask.IsCanceled); Assert.True(writeTask.IsCanceled);
context.Dispose(); context.Dispose();
#elif NETCOREAPP2_0 #elif NETCOREAPP2_0 || NETCOREAPP2_1
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif

View File

@ -188,7 +188,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys.Listener
// HttpClient re-tries the request because it doesn't know if the request was received. // HttpClient re-tries the request because it doesn't know if the request was received.
context = await server.AcceptAsync(Utilities.DefaultTimeout); context = await server.AcceptAsync(Utilities.DefaultTimeout);
context.Abort(); context.Abort();
#elif NETCOREAPP2_0 #elif NETCOREAPP2_0 || NETCOREAPP2_1
#else #else
#error Target framework needs to be updated #error Target framework needs to be updated
#endif #endif

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -81,7 +81,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
Assert.Equal(0, response.ContentLength); Assert.Equal(0, response.ContentLength);
Assert.NotNull(response.Headers["Date"]); Assert.NotNull(response.Headers["Date"]);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
#if NETCOREAPP2_0 // WebHeaderCollection.GetValues() not available in CoreCLR. #if NETCOREAPP2_0 || NETCOREAPP2_1 // WebHeaderCollection.GetValues() not available in CoreCLR.
Assert.Equal("custom1, and custom2, custom3", response.Headers["WWW-Authenticate"]); Assert.Equal("custom1, and custom2, custom3", response.Headers["WWW-Authenticate"]);
#elif NET461 #elif NET461
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("WWW-Authenticate")); Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("WWW-Authenticate"));
@ -111,7 +111,7 @@ namespace Microsoft.AspNetCore.Server.HttpSys
Assert.Equal(0, response.ContentLength); Assert.Equal(0, response.ContentLength);
Assert.NotNull(response.Headers["Date"]); Assert.NotNull(response.Headers["Date"]);
Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]); Assert.Equal("Microsoft-HTTPAPI/2.0", response.Headers["Server"]);
#if NETCOREAPP2_0 // WebHeaderCollection.GetValues() not available in CoreCLR. #if NETCOREAPP2_0 || NETCOREAPP2_1 // WebHeaderCollection.GetValues() not available in CoreCLR.
Assert.Equal("custom1, and custom2, custom3", response.Headers["Custom-Header1"]); Assert.Equal("custom1, and custom2, custom3", response.Headers["Custom-Header1"]);
#elif NET461 #elif NET461
Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("Custom-Header1")); Assert.Equal(new string[] { "custom1, and custom2", "custom3" }, response.Headers.GetValues("Custom-Header1"));

View File

@ -1,8 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks> <TargetFrameworks>$(StandardTestTfms)</TargetFrameworks>
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>