From 676590eb32601bce194565bb6ca466314a51ef71 Mon Sep 17 00:00:00 2001 From: Andrew Stanton-Nurse Date: Fri, 31 Mar 2017 13:22:51 -0700 Subject: [PATCH] react to aspnet/Hosting#996 (#349) --- IISIntegration.sln | 24 ++++++--- build/dependencies.props | 3 +- test/FunctionalTests/FunctionalTests.csproj | 3 +- test/FunctionalTests/HelloWorldTest.cs | 50 ++++++++++--------- test/FunctionalTests/Helpers.cs | 4 +- test/FunctionalTests/HttpsTest.cs | 39 +++++++++------ test/FunctionalTests/NtlmAuthentationTest.cs | 29 ++++++----- test/FunctionalTests/XunitLogger.cs | 52 -------------------- test/FunctionalTests/XunitLoggerProvider.cs | 26 ---------- 9 files changed, 88 insertions(+), 142 deletions(-) delete mode 100644 test/FunctionalTests/XunitLogger.cs delete mode 100644 test/FunctionalTests/XunitLoggerProvider.cs diff --git a/IISIntegration.sln b/IISIntegration.sln index 0c3df371f7..0e158af734 100644 --- a/IISIntegration.sln +++ b/IISIntegration.sln @@ -1,6 +1,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.26228.4 +VisualStudioVersion = 15.0.26228.10 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{04B1EDB6-E967-4D25-89B9-E6F8304038CD}" EndProject @@ -18,12 +18,20 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "IISSample", "samples\IISSam EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IISIntegration", "src\Microsoft.AspNetCore.Server.IISIntegration\Microsoft.AspNetCore.Server.IISIntegration.csproj", "{8B3446E8-E6A8-4591-AA63-A95837C6E97C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests", "test\FunctionalTests\FunctionalTests.csproj", "{7F2F50C7-610F-4B69-B945-CA283511A587}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IISIntegration.Tests", "test\Microsoft.AspNetCore.Server.IISIntegration.Tests\Microsoft.AspNetCore.Server.IISIntegration.Tests.csproj", "{4106DB10-E09F-480E-9CE6-B39235512EE6}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestSites", "test\TestSites\TestSites.csproj", "{F54715C3-88D8-49E3-A291-C13570FE81FC}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{7E80C58E-9CC8-450C-8A8D-94FC76428150}" + ProjectSection(SolutionItems) = preProject + build\common.props = build\common.props + build\dependencies.props = build\dependencies.props + build\Key.snk = build\Key.snk + build\repo.props = build\repo.props + EndProjectSection +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "FunctionalTests", "test\FunctionalTests\FunctionalTests.csproj", "{A2F7598B-85E1-4F53-B307-55F2A21D39A2}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -38,10 +46,6 @@ Global {8B3446E8-E6A8-4591-AA63-A95837C6E97C}.Debug|Any CPU.Build.0 = Debug|Any CPU {8B3446E8-E6A8-4591-AA63-A95837C6E97C}.Release|Any CPU.ActiveCfg = Release|Any CPU {8B3446E8-E6A8-4591-AA63-A95837C6E97C}.Release|Any CPU.Build.0 = Release|Any CPU - {7F2F50C7-610F-4B69-B945-CA283511A587}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {7F2F50C7-610F-4B69-B945-CA283511A587}.Debug|Any CPU.Build.0 = Debug|Any CPU - {7F2F50C7-610F-4B69-B945-CA283511A587}.Release|Any CPU.ActiveCfg = Release|Any CPU - {7F2F50C7-610F-4B69-B945-CA283511A587}.Release|Any CPU.Build.0 = Release|Any CPU {4106DB10-E09F-480E-9CE6-B39235512EE6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {4106DB10-E09F-480E-9CE6-B39235512EE6}.Debug|Any CPU.Build.0 = Debug|Any CPU {4106DB10-E09F-480E-9CE6-B39235512EE6}.Release|Any CPU.ActiveCfg = Release|Any CPU @@ -50,6 +54,10 @@ Global {F54715C3-88D8-49E3-A291-C13570FE81FC}.Debug|Any CPU.Build.0 = Debug|Any CPU {F54715C3-88D8-49E3-A291-C13570FE81FC}.Release|Any CPU.ActiveCfg = Release|Any CPU {F54715C3-88D8-49E3-A291-C13570FE81FC}.Release|Any CPU.Build.0 = Release|Any CPU + {A2F7598B-85E1-4F53-B307-55F2A21D39A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A2F7598B-85E1-4F53-B307-55F2A21D39A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A2F7598B-85E1-4F53-B307-55F2A21D39A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A2F7598B-85E1-4F53-B307-55F2A21D39A2}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -57,8 +65,8 @@ Global GlobalSection(NestedProjects) = preSolution {E4E2BDC4-A9C6-4AE9-B429-032EC83EDE64} = {C74B8F36-FD2F-45C9-9B8A-00E7CF0126A9} {8B3446E8-E6A8-4591-AA63-A95837C6E97C} = {04B1EDB6-E967-4D25-89B9-E6F8304038CD} - {7F2F50C7-610F-4B69-B945-CA283511A587} = {EF30B533-D715-421A-92B7-92FEF460AC9C} {4106DB10-E09F-480E-9CE6-B39235512EE6} = {EF30B533-D715-421A-92B7-92FEF460AC9C} {F54715C3-88D8-49E3-A291-C13570FE81FC} = {EF30B533-D715-421A-92B7-92FEF460AC9C} + {A2F7598B-85E1-4F53-B307-55F2A21D39A2} = {EF30B533-D715-421A-92B7-92FEF460AC9C} EndGlobalSection EndGlobal diff --git a/build/dependencies.props b/build/dependencies.props index 32fc7069ad..33a968d7f4 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -1,7 +1,8 @@ - + 1.2.0-* 0.3.0-* + 0.4.0-* 1.0.0-* 4.3.0 2.0.0-* diff --git a/test/FunctionalTests/FunctionalTests.csproj b/test/FunctionalTests/FunctionalTests.csproj index 7d5b8b33bb..c32d9ba2f5 100644 --- a/test/FunctionalTests/FunctionalTests.csproj +++ b/test/FunctionalTests/FunctionalTests.csproj @@ -13,7 +13,8 @@ - + + diff --git a/test/FunctionalTests/HelloWorldTest.cs b/test/FunctionalTests/HelloWorldTest.cs index 92dfebf342..6911525fbb 100644 --- a/test/FunctionalTests/HelloWorldTest.cs +++ b/test/FunctionalTests/HelloWorldTest.cs @@ -9,58 +9,64 @@ using Microsoft.AspNetCore.Server.IntegrationTesting; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging; using Xunit; +using Xunit.Abstractions; using Xunit.Sdk; namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { - // Uses ports ranging 5061 - 5069. public class HelloWorldTests { + private readonly ITestOutputHelper _output; + + public HelloWorldTests(ITestOutputHelper output) + { + _output = output; + } + [ConditionalTheory] [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)] - //[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x86, "http://localhost:5061/", ServerType.Kestrel, ApplicationType.Portable)] - [InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5062/", ServerType.Kestrel, ApplicationType.Portable)] - public Task HelloWorld_IISExpress(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ServerType delegateServer, ApplicationType applicationType) + //[InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x86, ApplicationType.Portable)] + [InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)] + public Task HelloWorld_IISExpress(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType) { - return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, delegateServer, applicationType); + return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationType); } [ConditionalTheory] [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [FrameworkSkipCondition(RuntimeFrameworks.CLR)] - //[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5063/", ServerType.Kestrel, ApplicationType.Portable)] + //[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Portable)] // TODO reenable when https://github.com/dotnet/sdk/issues/696 is resolved - //[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5064/", ServerType.Kestrel, ApplicationType.Standalone)] - [InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5065/", ServerType.Kestrel, ApplicationType.Portable)] - public Task HelloWorld_IISExpress_CoreClr(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ServerType delegateServer, ApplicationType applicationType) + //[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) { - return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, delegateServer, applicationType); + return HelloWorld(ServerType.IISExpress, runtimeFlavor, architecture, applicationType); } [ConditionalTheory] [SkipIfEnvironmentVariableNotEnabled("IIS_VARIATIONS_ENABLED")] [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)] - [InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5069/", ServerType.Kestrel, ApplicationType.Portable)] - //[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5070/", ServerType.Kestrel, ApplicationType.Standalone)] - public Task HelloWorld_IIS(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ServerType delegateServer, ApplicationType applicationType) + [InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)] + //[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone)] + public Task HelloWorld_IIS(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType) { - return HelloWorld(ServerType.IIS, runtimeFlavor, architecture, applicationBaseUrl, delegateServer, applicationType); + return HelloWorld(ServerType.IIS, runtimeFlavor, architecture, applicationType); } - public async Task HelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ServerType delegateServer, ApplicationType applicationType) + public async Task HelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType) { - var logger = new LoggerFactory() - .AddConsole() - .AddDebug() - .CreateLogger($"HelloWorld:{serverType}:{runtimeFlavor}:{architecture}:{delegateServer}"); + var loggerFactory = new LoggerFactory() + .AddXunit(_output) + .AddDebug(); + var logger = loggerFactory.CreateLogger($"HelloWorld:{serverType}:{runtimeFlavor}:{architecture}"); using (logger.BeginScope("HelloWorldTest")) { var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture) { - ApplicationBaseUriHint = applicationBaseUrl, EnvironmentName = "HelloWorld", // Will pick the Start class named 'StartupHelloWorld', ServerConfigTemplateContent = (serverType == ServerType.IISExpress) ? File.ReadAllText("Http.config") : null, SiteName = "HttpTestSite", // This is configured in the Http.config @@ -68,9 +74,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests ApplicationType = applicationType }; - using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) + using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { - var deploymentResult = deployer.Deploy(); + var deploymentResult = await deployer.DeployAsync(); var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { diff --git a/test/FunctionalTests/Helpers.cs b/test/FunctionalTests/Helpers.cs index 85b7409162..c508bbefb2 100644 --- a/test/FunctionalTests/Helpers.cs +++ b/test/FunctionalTests/Helpers.cs @@ -1,4 +1,4 @@ -// 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. using System; @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public static string GetTestSitesPath() { return Path.GetFullPath( - Path.Combine(AppDomain.CurrentDomain.BaseDirectory, + Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "..", // tfm "..", // debug "..", // obj diff --git a/test/FunctionalTests/HttpsTest.cs b/test/FunctionalTests/HttpsTest.cs index bf50b05a18..f3f3db6b50 100644 --- a/test/FunctionalTests/HttpsTest.cs +++ b/test/FunctionalTests/HttpsTest.cs @@ -14,9 +14,18 @@ using Xunit.Sdk; namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { - // IisExpress preregisteres 44300-44399 ports. + // IIS Express preregisteres 44300-44399 ports with SSL bindings. + // So these tests always have to use ports in this range, and we can't rely on OS-allocated ports without a whole lot of ceremony around + // creating self-signed certificates and registering SSL bindings with HTTP.sys public class HttpsTest { + private readonly ITestOutputHelper _output; + + public HttpsTest(ITestOutputHelper output) + { + _output = output; + } + [ConditionalTheory] [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)] @@ -39,10 +48,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task HttpsHelloWorld(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType) { - var logger = new LoggerFactory() - .AddConsole() - .AddDebug() - .CreateLogger($"HttpsHelloWorld:{serverType}:{runtimeFlavor}:{architecture}"); + var loggerFactory = new LoggerFactory() + .AddConsole() + .AddDebug(); + var logger = loggerFactory.CreateLogger($"HttpsHelloWorld:{serverType}:{runtimeFlavor}:{architecture}"); using (logger.BeginScope("HttpsHelloWorldTest")) { @@ -56,9 +65,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests ApplicationType = applicationType }; - using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) + using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { - var deploymentResult = deployer.Deploy(); + var deploymentResult = await deployer.DeployAsync(); var handler = new HttpClientHandler(); handler.ServerCertificateCustomValidationCallback = (a, b, c, d) => true; var httpClient = new HttpClient(handler) @@ -111,7 +120,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [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:44401/", ApplicationType.Portable)] + [InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "https://localhost:44301/", ApplicationType.Portable)] public Task Https_HelloWorld_ClientCert(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType) { return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: true); @@ -120,7 +129,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [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:44400/", ApplicationType.Standalone)] + //[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "https://localhost:44302/", ApplicationType.Standalone)] public Task Https_HelloWorld_ClientCert_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType) { return HttpsHelloWorldCerts(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType, sendClientCert: true); @@ -128,10 +137,10 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public async Task HttpsHelloWorldCerts(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType, bool sendClientCert) { -Console.WriteLine("Running test"); - var logger = new LoggerFactory() - .AddConsole() - .CreateLogger($"HttpsHelloWorldCerts:{serverType}:{runtimeFlavor}:{architecture}"); + var loggerFactory = new LoggerFactory() + .AddXunit(_output) + .AddDebug(); + var logger = loggerFactory.CreateLogger($"HttpsHelloWorldCerts:{serverType}:{runtimeFlavor}:{architecture}"); using (logger.BeginScope("HttpsHelloWorldTest")) { @@ -145,9 +154,9 @@ Console.WriteLine("Running test"); ApplicationType = applicationType }; - using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) + using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { - var deploymentResult = deployer.Deploy(); + var deploymentResult = await deployer.DeployAsync(); var handler = new HttpClientHandler(); handler.ServerCertificateCustomValidationCallback = (a, b, c, d) => true; handler.ClientCertificateOptions = ClientCertificateOption.Manual; diff --git a/test/FunctionalTests/NtlmAuthentationTest.cs b/test/FunctionalTests/NtlmAuthentationTest.cs index 4838ae7152..cf4995a2fe 100644 --- a/test/FunctionalTests/NtlmAuthentationTest.cs +++ b/test/FunctionalTests/NtlmAuthentationTest.cs @@ -16,7 +16,6 @@ using Xunit.Abstractions; namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests { - // Uses ports ranging 5050 - 5060. public class NtlmAuthenticationTests { private readonly ITestOutputHelper _output; @@ -29,28 +28,29 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests [ConditionalTheory] [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [FrameworkSkipCondition(RuntimeFrameworks.CoreCLR)] - [InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, "http://localhost:5051/", ApplicationType.Portable)] - public Task NtlmAuthentication(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType) + [InlineData(RuntimeFlavor.Clr, RuntimeArchitecture.x64, ApplicationType.Portable)] + public Task NtlmAuthentication(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType) { - return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType); + return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationType); } [ConditionalTheory(Skip = "No test configuration enabled")] [OSSkipCondition(OperatingSystems.Linux | OperatingSystems.MacOSX)] [FrameworkSkipCondition(RuntimeFrameworks.CLR)] - //[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, "http://localhost:5050/", ApplicationType.Standalone)] + //[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x86, ApplicationType.Standalone)] // TODO reenable when https://github.com/dotnet/sdk/issues/696 is resolved - //[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, "http://localhost:5052/", ApplicationType.Standalone)] - public Task NtlmAuthentication_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType) + //[InlineData(RuntimeFlavor.CoreClr, RuntimeArchitecture.x64, ApplicationType.Standalone)] + public Task NtlmAuthentication_CoreCLR(RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType) { - return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationBaseUrl, applicationType); + return NtlmAuthentication(ServerType.IISExpress, runtimeFlavor, architecture, applicationType); } - public async Task NtlmAuthentication(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, string applicationBaseUrl, ApplicationType applicationType) + public async Task NtlmAuthentication(ServerType serverType, RuntimeFlavor runtimeFlavor, RuntimeArchitecture architecture, ApplicationType applicationType) { - var factory = new LoggerFactory().AddDebug(); - factory.AddProvider(new XunitLoggerProvider(_output)); - var logger = factory.CreateLogger($"NtlmAuthentication:{serverType}:{runtimeFlavor}:{architecture}"); + var loggerFactory = new LoggerFactory() + .AddXunit(_output) + .AddDebug(); + var logger = loggerFactory.CreateLogger($"NtlmAuthentication:{serverType}:{runtimeFlavor}:{architecture}"); using (logger.BeginScope("NtlmAuthenticationTest")) { @@ -60,7 +60,6 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests var deploymentParameters = new DeploymentParameters(Helpers.GetTestSitesPath(), serverType, runtimeFlavor, architecture) { - ApplicationBaseUriHint = applicationBaseUrl, 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 @@ -71,9 +70,9 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests : null }; - using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, logger)) + using (var deployer = ApplicationDeployerFactory.Create(deploymentParameters, loggerFactory)) { - var deploymentResult = deployer.Deploy(); + var deploymentResult = await deployer.DeployAsync(); var httpClientHandler = new HttpClientHandler(); var httpClient = new HttpClient(httpClientHandler) { diff --git a/test/FunctionalTests/XunitLogger.cs b/test/FunctionalTests/XunitLogger.cs deleted file mode 100644 index 47ee01c3b6..0000000000 --- a/test/FunctionalTests/XunitLogger.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// See License.txt in the project root for license information - -using System; -using System.Linq; -using Microsoft.Extensions.Logging; -using Xunit.Abstractions; - -namespace Microsoft.AspNetCore.Testing -{ - public class XunitLogger : ILogger, IDisposable - { - private readonly ITestOutputHelper _output; - private readonly string _categoryName; - - public XunitLogger(ITestOutputHelper output, string categoryName) - {; - _output = output; - _categoryName = categoryName; - } - - public void Log( - LogLevel logLevel, EventId eventId, TState state, Exception exception, Func formatter) - { - var firstLinePrefix = $"| {logLevel} [{_categoryName}]: "; - var lines = formatter(state, exception).Split('\n'); - _output.WriteLine(firstLinePrefix + lines.First()); - - var additionalLinePrefix = "|" + new string(' ', firstLinePrefix.Length - 1); - foreach (var line in lines.Skip(1)) - { - _output.WriteLine(additionalLinePrefix + line.Trim('\r')); - } - } - - public bool IsEnabled(LogLevel logLevel) => true; - - public IDisposable BeginScope(TState state) - => new NullScope(); - - private class NullScope : IDisposable - { - public void Dispose() - { - } - } - - public void Dispose() - { - } - } -} diff --git a/test/FunctionalTests/XunitLoggerProvider.cs b/test/FunctionalTests/XunitLoggerProvider.cs deleted file mode 100644 index c42129d409..0000000000 --- a/test/FunctionalTests/XunitLoggerProvider.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// See License.txt in the project root for license information - -using Microsoft.Extensions.Logging; -using Xunit.Abstractions; - -namespace Microsoft.AspNetCore.Testing -{ - class XunitLoggerProvider : ILoggerProvider - { - private readonly ITestOutputHelper _output; - - public XunitLoggerProvider(ITestOutputHelper output) - { - _output = output; - } - public ILogger CreateLogger(string categoryName) - { - return new XunitLogger(_output, categoryName); - } - - public void Dispose() - { - } - } -}