Update samples and tests to target netcoreapp2.1

This commit is contained in:
Pranav K 2017-11-16 20:17:18 -08:00
parent 2dc6598c7b
commit d971bfc8b7
14 changed files with 46 additions and 11 deletions

View File

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

View File

@ -1,2 +1,2 @@
version:2.1.0-preview1-15550
commithash:0dd080d0d87b4d1966ec0af9961dc8bacc04f84f
version:2.1.0-preview1-15569
commithash:47312a6364ad0ee6d7052eada54da940c9b17931

View File

@ -2,7 +2,7 @@
<PropertyGroup>
<Description>Music store application on ASP.NET Core</Description>
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
<TargetFrameworks>netcoreapp2.1;netcoreapp2.0;net461</TargetFrameworks>
<DefineConstants>$(DefineConstants);DEMO</DefineConstants>
<MvcRazorCompileOnPublish>true</MvcRazorCompileOnPublish>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>

View File

@ -1,6 +1,13 @@
<Project>
<Import Project="..\Directory.Build.props" />
<PropertyGroup>
<DeveloperBuildTestTfms>netcoreapp2.1</DeveloperBuildTestTfms>
<StandardTestTfms>$(DeveloperBuildTestTfms)</StandardTestTfms>
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' ">netcoreapp2.1;netcoreapp2.0</StandardTestTfms>
<StandardTestTfms Condition=" '$(DeveloperBuild)' != 'true' AND '$(OS)' == 'Windows_NT' ">$(StandardTestTfms);net461</StandardTestTfms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="$(MicrosoftNETTestSdkPackageVersion)" />
<PackageReference Include="xunit" Version="$(XunitPackageVersion)" />

View File

@ -39,5 +39,25 @@ namespace E2ETests
return false;
}
}
public static string GetTargetFramework(RuntimeFlavor flavor)
{
if (flavor == RuntimeFlavor.Clr)
{
return "net461";
}
else if (flavor == RuntimeFlavor.CoreClr)
{
#if NETCOREAPP2_0
return "netcoreapp2.0";
#elif NETCOREAPP2_1
return "netcoreapp2.1";
#else
#error Target Frameworks need to be updated
#endif
}
throw new ArgumentException($"Unknown runtime flavor '{flavor}.");
}
}
}

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFrameworks>netcoreapp2.1;netcoreapp2.0</TargetFrameworks>
<UserSecretsId>MusicStore.E2ETests</UserSecretsId>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<ServerGarbageCollection>true</ServerGarbageCollection>

View File

@ -45,6 +45,7 @@ namespace E2ETests
return NtlmAuthenticationTest(ServerType.IISExpress, RuntimeFlavor.CoreClr, ApplicationType.Standalone);
}
#if NETCOREAPP2_1 // Avoid running CLR based tests once on netcoreapp2.0 and netcoreapp2.1 each
[ConditionalFact]
public Task NtlmAuthenticationTest_WebListener_CLR()
{
@ -56,6 +57,7 @@ namespace E2ETests
{
return NtlmAuthenticationTest(ServerType.IISExpress, RuntimeFlavor.Clr, ApplicationType.Standalone);
}
#endif
private async Task NtlmAuthenticationTest(ServerType serverType, RuntimeFlavor runtimeFlavor, ApplicationType applicationType)
{
@ -70,7 +72,7 @@ namespace E2ETests
{
PublishApplicationBeforeDeployment = true,
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0",
TargetFramework = Helpers.GetTargetFramework(runtimeFlavor),
Configuration = Helpers.GetCurrentBuildConfiguration(),
ApplicationType = applicationType,
EnvironmentName = "NtlmAuthentication", //Will pick the Start class named 'StartupNtlmAuthentication'

View File

@ -50,7 +50,7 @@ namespace E2ETests
{
PublishApplicationBeforeDeployment = true,
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0",
TargetFramework = Helpers.GetTargetFramework(runtimeFlavor),
Configuration = Helpers.GetCurrentBuildConfiguration(),
ApplicationType = applicationType,
EnvironmentName = "OpenIdConnectTesting",

View File

@ -35,7 +35,7 @@ namespace E2ETests
{
PublishApplicationBeforeDeployment = true,
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
TargetFramework = runtimeFlavor == RuntimeFlavor.Clr ? "net461" : "netcoreapp2.0",
TargetFramework = Helpers.GetTargetFramework(runtimeFlavor),
Configuration = Helpers.GetCurrentBuildConfiguration(),
ApplicationType = applicationType,
UserAdditionalCleanup = parameters =>

View File

@ -1,3 +1,4 @@
#if NETCOREAPP2_1 // Avoid running CLR based tests once on netcoreapp2.0 and netcoreapp2.1 each
using System.Threading.Tasks;
using Microsoft.AspNetCore.Server.IntegrationTesting;
using Microsoft.AspNetCore.Testing.xunit;
@ -38,3 +39,4 @@ namespace E2ETests
=> _testRunner.RunTests(serverType, runtimeFlavor, applicationType, RuntimeArchitecture.x86);
}
}
#endif

View File

@ -37,7 +37,7 @@ namespace E2ETests
SiteName = "MusicStoreTestSite",
PublishApplicationBeforeDeployment = true,
PreservePublishedApplicationForDebugging = Helpers.PreservePublishedApplicationForDebugging,
TargetFramework = runtimeFlavor == RuntimeFlavor.CoreClr ? "netcoreapp2.0" : "net461",
TargetFramework = Helpers.GetTargetFramework(runtimeFlavor),
Configuration = Helpers.GetCurrentBuildConfiguration(),
ApplicationType = applicationType,
UserAdditionalCleanup = parameters =>

View File

@ -246,7 +246,7 @@ namespace E2ETests
_remoteDeploymentConfig.AccountName,
_remoteDeploymentConfig.AccountPassword)
{
TargetFramework = "netcoreapp2.0",
TargetFramework = Helpers.GetTargetFramework(RuntimeFlavor.CoreClr),
ApplicationBaseUriHint = applicationBaseUrl,
ApplicationType = applicationType
};

View File

@ -22,7 +22,7 @@ namespace E2ETests.SmokeTestsUsingStore
public async Task SmokeTestSuite(ServerType serverType)
{
var targetFramework = "netcoreapp2.0";
var targetFramework = Helpers.GetTargetFramework(RuntimeFlavor.CoreClr);
var testName = $"SmokeTestsUsingStore_{serverType}";
using (StartLog(out var loggerFactory, testName))
{

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>