diff --git a/src/Hosting/Server.IntegrationTesting/src/Common/HostingModel.cs b/src/Hosting/Server.IntegrationTesting/src/Common/HostingModel.cs index 5eea2b8ce3..e1608bba80 100644 --- a/src/Hosting/Server.IntegrationTesting/src/Common/HostingModel.cs +++ b/src/Hosting/Server.IntegrationTesting/src/Common/HostingModel.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. namespace Microsoft.AspNetCore.Server.IntegrationTesting diff --git a/src/Hosting/Server.IntegrationTesting/src/Common/IWebHostExtensions.cs b/src/Hosting/Server.IntegrationTesting/src/Common/IWebHostExtensions.cs deleted file mode 100644 index 732a598ab8..0000000000 --- a/src/Hosting/Server.IntegrationTesting/src/Common/IWebHostExtensions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using Microsoft.AspNetCore.Hosting.Server.Features; -using System.Linq; - -namespace Microsoft.AspNetCore.Hosting -{ - public static class IWebHostExtensions - { - public static string GetAddress(this IWebHost host) - { - return host.ServerFeatures.Get().Addresses.First(); - } - } -} diff --git a/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj b/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj index 8edf4ff3f0..ba625f4332 100644 --- a/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj +++ b/src/Hosting/Server.IntegrationTesting/src/Microsoft.AspNetCore.Server.IntegrationTesting.csproj @@ -1,4 +1,4 @@ - + ASP.NET Core helpers to deploy applications to IIS Express, IIS, WebListener and Kestrel for testing. @@ -19,7 +19,6 @@ - diff --git a/src/Hosting/build.cmd b/src/Hosting/build.cmd new file mode 100644 index 0000000000..2406296662 --- /dev/null +++ b/src/Hosting/build.cmd @@ -0,0 +1,3 @@ +@ECHO OFF +SET RepoRoot=%~dp0..\.. +%RepoRoot%\build.cmd -projects %~dp0**\*.*proj %* diff --git a/src/Middleware/StaticFiles/test/FunctionalTests/FallbackStaticFileTest.cs b/src/Middleware/StaticFiles/test/FunctionalTests/FallbackStaticFileTest.cs index 2d12ee7a30..58b80d2952 100644 --- a/src/Middleware/StaticFiles/test/FunctionalTests/FallbackStaticFileTest.cs +++ b/src/Middleware/StaticFiles/test/FunctionalTests/FallbackStaticFileTest.cs @@ -53,7 +53,7 @@ namespace Microsoft.AspNetCore.StaticFiles using (var server = builder.Start(TestUrlHelper.GetTestUrl(ServerType.Kestrel))) { var environment = server.Services.GetRequiredService(); - using (var client = new HttpClient { BaseAddress = new Uri(server.GetAddress()) }) + using (var client = new HttpClient { BaseAddress = new Uri(Helpers.GetAddress(server)) }) { var response = await client.GetAsync("hello"); var responseText = await response.Content.ReadAsStringAsync(); @@ -98,7 +98,7 @@ namespace Microsoft.AspNetCore.StaticFiles using (var server = builder.Start(TestUrlHelper.GetTestUrl(ServerType.Kestrel))) { var environment = server.Services.GetRequiredService(); - using (var client = new HttpClient { BaseAddress = new Uri(server.GetAddress()) }) + using (var client = new HttpClient { BaseAddress = new Uri(Helpers.GetAddress(server)) }) { var response = await client.GetAsync("hello"); var responseText = await response.Content.ReadAsStringAsync(); diff --git a/src/Middleware/StaticFiles/test/FunctionalTests/Helpers.cs b/src/Middleware/StaticFiles/test/FunctionalTests/Helpers.cs new file mode 100644 index 0000000000..12e634cda1 --- /dev/null +++ b/src/Middleware/StaticFiles/test/FunctionalTests/Helpers.cs @@ -0,0 +1,17 @@ +// 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.Linq; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Hosting.Server.Features; + +namespace Microsoft.AspNetCore.StaticFiles +{ + public static class Helpers + { + public static string GetAddress(IWebHost server) + { + return server.ServerFeatures.Get().Addresses.First(); + } + } +} diff --git a/src/Middleware/StaticFiles/test/FunctionalTests/StaticFileMiddlewareTests.cs b/src/Middleware/StaticFiles/test/FunctionalTests/StaticFileMiddlewareTests.cs index f90c79ca12..b4ca20cf0a 100644 --- a/src/Middleware/StaticFiles/test/FunctionalTests/StaticFileMiddlewareTests.cs +++ b/src/Middleware/StaticFiles/test/FunctionalTests/StaticFileMiddlewareTests.cs @@ -35,7 +35,7 @@ namespace Microsoft.AspNetCore.StaticFiles using (var server = builder.Start(TestUrlHelper.GetTestUrl(ServerType.Kestrel))) { - using (var client = new HttpClient { BaseAddress = new Uri(server.GetAddress()) }) + using (var client = new HttpClient { BaseAddress = new Uri(Helpers.GetAddress(server)) }) { var response = await client.GetAsync("TestDocument.txt"); @@ -76,7 +76,7 @@ namespace Microsoft.AspNetCore.StaticFiles using (var server = builder.Start(TestUrlHelper.GetTestUrl(ServerType.Kestrel))) { - using (var client = new HttpClient { BaseAddress = new Uri(server.GetAddress()) }) + using (var client = new HttpClient { BaseAddress = new Uri(Helpers.GetAddress(server)) }) { var response = await client.GetAsync("TestDocument.txt"); @@ -97,7 +97,7 @@ namespace Microsoft.AspNetCore.StaticFiles using (var server = builder.Start(TestUrlHelper.GetTestUrl(ServerType.Kestrel))) { - using (var client = new HttpClient { BaseAddress = new Uri(server.GetAddress()) }) + using (var client = new HttpClient { BaseAddress = new Uri(Helpers.GetAddress(server)) }) { var last = File.GetLastWriteTimeUtc(Path.Combine(AppContext.BaseDirectory, "TestDocument.txt")); var response = await client.GetAsync("TestDocument.txt"); @@ -143,7 +143,7 @@ namespace Microsoft.AspNetCore.StaticFiles { var hostingEnvironment = server.Services.GetService(); - using (var client = new HttpClient { BaseAddress = new Uri(server.GetAddress()) }) + using (var client = new HttpClient { BaseAddress = new Uri(Helpers.GetAddress(server)) }) { var fileInfo = hostingEnvironment.WebRootFileProvider.GetFileInfo(Path.GetFileName(requestUrl)); var response = await client.GetAsync(requestUrl); @@ -181,7 +181,7 @@ namespace Microsoft.AspNetCore.StaticFiles { var hostingEnvironment = server.Services.GetService(); - using (var client = new HttpClient { BaseAddress = new Uri(server.GetAddress()) }) + using (var client = new HttpClient { BaseAddress = new Uri(Helpers.GetAddress(server)) }) { var fileInfo = hostingEnvironment.WebRootFileProvider.GetFileInfo(Path.GetFileName(requestUrl)); var request = new HttpRequestMessage(HttpMethod.Head, requestUrl); @@ -261,7 +261,7 @@ namespace Microsoft.AspNetCore.StaticFiles using (var server = builder.Start(TestUrlHelper.GetTestUrl(serverType))) { // We don't use HttpClient here because it's disconnect behavior varies across platforms. - var socket = SendSocketRequestAsync(server.GetAddress(), "/TestDocument1MB.txt"); + var socket = SendSocketRequestAsync(Helpers.GetAddress(server), "/TestDocument1MB.txt"); await requestReceived.Task.TimeoutAfter(interval); socket.LingerState = new LingerOption(true, 0);