Re-enable desktop tests
* Remove FrameworkSkipCondition to enable desktop tests. * Remove ConditionalTheory \ ConditionalFact since it's no longer required. * Replace InlineData with meaningful test names * Cleanup commented out lines of code
This commit is contained in:
parent
c267d192d6
commit
a224b1a833
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
#if NETCOREAPP2_0
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
|
|
@ -20,31 +20,23 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
{
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||
//[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||
public Task HelloWorld_IISExpress(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||
[Fact]
|
||||
public Task HelloWorld_IISExpress_Clr_X64_Portable()
|
||||
{
|
||||
return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
|
||||
return HelloWorld(RuntimeFlavor.Clr, ApplicationType.Portable);
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable)]
|
||||
// TODO reenable when https://github.com/aspnet/IISIntegration/issues/373 is resolved
|
||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||
[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||
public Task HelloWorld_IISExpress_CoreClr(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||
[Fact]
|
||||
public Task HelloWorld_IISExpress_CoreClr_X64_Portable()
|
||||
{
|
||||
return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
|
||||
return HelloWorld(RuntimeFlavor.CoreClr, ApplicationType.Portable);
|
||||
}
|
||||
|
||||
private async Task HelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||
private async Task HelloWorld(RuntimeFlavor runtimeFlavor, ApplicationType applicationType)
|
||||
{
|
||||
var testName = $"HelloWorld_{serverType}_{runtimeFlavor}_{architecture}";
|
||||
var serverType = ServerType.IISExpress;
|
||||
var architecture = RuntimeArchitecture.x64;
|
||||
var testName = $"HelloWorld_{runtimeFlavor}";
|
||||
using (StartLog(out var loggerFactory, testName))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger("HelloWorldTest");
|
||||
|
|
@ -101,3 +93,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
}
|
||||
}
|
||||
}
|
||||
#elif NET461
|
||||
#else
|
||||
#error Target frameworks need to be updated
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
#if NETCOREAPP2_0
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
|
@ -7,7 +8,6 @@ using System.Net.Http;
|
|||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
|
|
@ -25,29 +25,25 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
{
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "https://localhost:44396/", ApplicationType.Portable)]
|
||||
public Task Https_HelloWorld(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||
[Fact]
|
||||
public Task Https_HelloWorld_CLR_X64()
|
||||
{
|
||||
return HttpsHelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType);
|
||||
return HttpsHelloWorld(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44396);
|
||||
}
|
||||
|
||||
[ConditionalTheory(Skip = "No test configuration enabled")]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "https://localhost:44394/", ApplicationType.Portable)]
|
||||
// TODO reenable when https://github.com/aspnet/IISIntegration/issues/373 is resolved
|
||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "https://localhost:44395/", ApplicationType.Standalone)]
|
||||
public Task Https_HelloWorld_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||
[Fact]
|
||||
public Task Https_HelloWorld_CoreCLR_X64_Portable()
|
||||
{
|
||||
return HttpsHelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType);
|
||||
return HttpsHelloWorld(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 44394);
|
||||
}
|
||||
|
||||
private async Task HttpsHelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||
private async Task HttpsHelloWorld(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port)
|
||||
{
|
||||
var testName = $"HttpsHelloWorld_{serverType}_{runtimeFlavor}_{architecture}";
|
||||
var serverType = ServerType.IISExpress;
|
||||
var architecture = RuntimeArchitecture.x64;
|
||||
|
||||
var applicationBaseUrl = $"https://localhost:{port}/";
|
||||
var testName = $"HttpsHelloWorld_{runtimeFlavor}";
|
||||
using (StartLog(out var loggerFactory, testName))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger("HttpsHelloWorldTest");
|
||||
|
|
@ -91,47 +87,40 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
}
|
||||
}
|
||||
|
||||
[ConditionalTheory(Skip = "No test configuration enabled")]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||
//[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x86, "https://localhost:44399/", ApplicationType.Standalone)]
|
||||
public Task Https_HelloWorld_NoClientCert(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||
[Fact]
|
||||
public Task Https_HelloWorld_NoClientCert_CoreCLR_X64_Portable()
|
||||
{
|
||||
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: false);
|
||||
return HttpsHelloWorldCerts(RuntimeFlavor.CoreClr, ApplicationType.Portable , port: 44398, sendClientCert: false);
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
||||
// TODO reenable when https://github.com/aspnet/IISIntegration/issues/373 is resolved
|
||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "https://localhost:44397/", ApplicationType.Standalone)]
|
||||
[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "https://localhost:44398/", ApplicationType.Portable)]
|
||||
public Task Https_HelloWorld_NoClientCert_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||
[Fact]
|
||||
public Task Https_HelloWorld_NoClientCert_Clr_X64()
|
||||
{
|
||||
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: false);
|
||||
return HttpsHelloWorldCerts(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44398, sendClientCert: false);
|
||||
}
|
||||
|
||||
[ConditionalTheory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "https://localhost:44301/", ApplicationType.Portable)]
|
||||
public Task Https_HelloWorld_ClientCert(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||
#pragma warning disable xUnit1004 // Test methods should not be skipped
|
||||
[Fact(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
|
||||
#pragma warning restore xUnit1004 // Test methods should not be skipped
|
||||
public Task Https_HelloWorld_ClientCert_Clr_X64()
|
||||
{
|
||||
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: true);
|
||||
return HttpsHelloWorldCerts(RuntimeFlavor.Clr, ApplicationType.Portable, port: 44301, sendClientCert: true);
|
||||
}
|
||||
|
||||
[ConditionalTheory(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "https://localhost:44302/", ApplicationType.Standalone)]
|
||||
public Task Https_HelloWorld_ClientCert_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType)
|
||||
#pragma warning disable xUnit1004 // Test methods should not be skipped
|
||||
[Fact(Skip = "Manual test only, selecting a client cert is non-determanistic on different machines.")]
|
||||
#pragma warning restore xUnit1004 // Test methods should not be skipped
|
||||
public Task Https_HelloWorld_ClientCert_CoreCLR_X64_Portable()
|
||||
{
|
||||
return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: true);
|
||||
return HttpsHelloWorldCerts(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 44302, sendClientCert: true);
|
||||
}
|
||||
|
||||
private async Task HttpsHelloWorldCerts(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType, bool sendClientCert)
|
||||
private async Task HttpsHelloWorldCerts(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port, bool sendClientCert)
|
||||
{
|
||||
var testName = $"HttpsHelloWorldCerts_{serverType}_{runtimeFlavor}_{architecture}";
|
||||
var serverType = ServerType.IISExpress;
|
||||
var architecture = RuntimeArchitecture.x64;
|
||||
var applicationBaseUrl = $"https://localhost:{port}/";
|
||||
var testName = $"HttpsHelloWorldCerts_{runtimeFlavor}";
|
||||
using (StartLog(out var loggerFactory, testName))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger("HttpsHelloWorldTest");
|
||||
|
|
@ -226,3 +215,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
}
|
||||
}
|
||||
}
|
||||
#elif NET461
|
||||
#else
|
||||
#error Target frameworks need to be updated
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<Import Project="..\..\build\common.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
|
||||
<NoWarn>$(NoWarn);xUnit1003</NoWarn>
|
||||
<TargetFrameworks>netcoreapp2.0;net461</TargetFrameworks>
|
||||
<TargetFrameworks Condition=" '$(OS)' != 'Windows_NT' ">netcoreapp2.0</TargetFrameworks>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -1,13 +1,16 @@
|
|||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Copyright (c) .NET Foundation. All rights reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
|
||||
|
||||
#if NET461
|
||||
// Per https://github.com/dotnet/corefx/issues/5045, HttpClientHandler.UseDefaultCredentials does not work correctly in CoreFx.
|
||||
// We'll require the desktop HttpClient to run these tests.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Microsoft.Extensions.Logging.Testing;
|
||||
using Xunit;
|
||||
|
|
@ -22,29 +25,23 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
{
|
||||
}
|
||||
|
||||
[ConditionalTheory]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)]
|
||||
[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)]
|
||||
public Task NtlmAuthentication(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||
[Fact]
|
||||
public Task NtlmAuthentication_Clr_X64()
|
||||
{
|
||||
return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
|
||||
return NtlmAuthentication(RuntimeFlavor.Clr, ApplicationType.Portable, port: 5051);
|
||||
}
|
||||
|
||||
[ConditionalTheory(Skip = "No test configuration enabled")]
|
||||
[OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)]
|
||||
[FrameworkSkipCondition(RuntimeFrameworks.CLR)]
|
||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone)]
|
||||
// TODO reenable when https://github.com/aspnet/IISIntegration/issues/373 is resolved
|
||||
//[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)]
|
||||
Task NtlmAuthentication_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||
[Fact]
|
||||
public Task NtlmAuthentication_CoreClr_X64_Portable()
|
||||
{
|
||||
return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationType);
|
||||
return NtlmAuthentication(RuntimeFlavor.CoreClr, ApplicationType.Portable, port: 5052);
|
||||
}
|
||||
|
||||
private async Task NtlmAuthentication(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType)
|
||||
private async Task NtlmAuthentication(RuntimeFlavor runtimeFlavor, ApplicationType applicationType, int port)
|
||||
{
|
||||
var testName = $"NtlmAuthentication_{serverType}_{runtimeFlavor}_{architecture}";
|
||||
var serverType = ServerType.IISExpress;
|
||||
var architecture = RuntimeArchitecture.x64;
|
||||
var testName = $"NtlmAuthentication_{runtimeFlavor}";
|
||||
using (StartLog(out var loggerFactory, testName))
|
||||
{
|
||||
var logger = loggerFactory.CreateLogger("NtlmAuthenticationTest");
|
||||
|
|
@ -55,6 +52,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
|
||||
var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture)
|
||||
{
|
||||
ApplicationBaseUriHint = $"http://localhost:{port}",
|
||||
EnvironmentName = "NtlmAuthentication", // Will pick the Start class named 'StartupNtlmAuthentication'
|
||||
ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("NtlmAuthentation.config") : null,
|
||||
SiteName = "NtlmAuthenticationTestSite", // This is configured in the NtlmAuthentication.config
|
||||
|
|
@ -117,10 +115,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
responseText = await response.Content.ReadAsStringAsync();
|
||||
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||
Assert.NotEmpty(responseText);
|
||||
|
||||
response = await httpClient.GetAsync("/AutoForbid");
|
||||
responseText = await response.Content.ReadAsStringAsync();
|
||||
Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
|
||||
}
|
||||
catch (XunitException)
|
||||
{
|
||||
|
|
@ -133,3 +127,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
|
|||
}
|
||||
}
|
||||
}
|
||||
#elif NETCOREAPP2_0
|
||||
#else
|
||||
#error Target frameworks need to be updated
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -61,11 +61,6 @@ namespace TestSites
|
|||
return context.ForbidAsync();
|
||||
}
|
||||
|
||||
if (context.Request.Path.Equals("/AutoForbid"))
|
||||
{
|
||||
return context.ChallengeAsync();
|
||||
}
|
||||
|
||||
if (context.Request.Path.Equals("/RestrictedNTLM"))
|
||||
{
|
||||
if (string.Equals("NTLM", context.User.Identity.AuthenticationType, StringComparison.Ordinal))
|
||||
|
|
|
|||
Loading…
Reference in New Issue