From 68d1d4ce12e24c4a9a32284fc9e5a341b32edda0 Mon Sep 17 00:00:00 2001 From: John Luo Date: Mon, 15 May 2017 19:11:37 -0700 Subject: [PATCH] Remove TestProjectHelpers from Server.IntegrationTesting --- .../xunit/TestProjectHelpers.cs | 33 ------------------- ....AspNetCore.Hosting.FunctionalTests.csproj | 1 + .../ShutdownTests.cs | 4 +-- 3 files changed, 3 insertions(+), 35 deletions(-) delete mode 100644 src/Microsoft.AspNetCore.Server.IntegrationTesting/xunit/TestProjectHelpers.cs diff --git a/src/Microsoft.AspNetCore.Server.IntegrationTesting/xunit/TestProjectHelpers.cs b/src/Microsoft.AspNetCore.Server.IntegrationTesting/xunit/TestProjectHelpers.cs deleted file mode 100644 index 837e34497c..0000000000 --- a/src/Microsoft.AspNetCore.Server.IntegrationTesting/xunit/TestProjectHelpers.cs +++ /dev/null @@ -1,33 +0,0 @@ -// 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; -using System.IO; - -namespace Microsoft.AspNetCore.Server.IntegrationTesting.xunit -{ - public class TestProjectHelpers - { - private const string SolutionName = "Hosting.sln"; - - public static string GetSolutionRoot() - { - var applicationBasePath = AppContext.BaseDirectory; - - var directoryInfo = new DirectoryInfo(applicationBasePath); - do - { - var projectFileInfo = new FileInfo(Path.Combine(directoryInfo.FullName, SolutionName)); - if (projectFileInfo.Exists) - { - return projectFileInfo.DirectoryName; - } - - directoryInfo = directoryInfo.Parent; - } - while (directoryInfo.Parent != null); - - throw new Exception($"Solution file {SolutionName} could not be found using {applicationBasePath}"); - } - } -} diff --git a/test/Microsoft.AspNetCore.Hosting.FunctionalTests/Microsoft.AspNetCore.Hosting.FunctionalTests.csproj b/test/Microsoft.AspNetCore.Hosting.FunctionalTests/Microsoft.AspNetCore.Hosting.FunctionalTests.csproj index 20bb60d399..c40c84d1e4 100644 --- a/test/Microsoft.AspNetCore.Hosting.FunctionalTests/Microsoft.AspNetCore.Hosting.FunctionalTests.csproj +++ b/test/Microsoft.AspNetCore.Hosting.FunctionalTests/Microsoft.AspNetCore.Hosting.FunctionalTests.csproj @@ -17,6 +17,7 @@ + diff --git a/test/Microsoft.AspNetCore.Hosting.FunctionalTests/ShutdownTests.cs b/test/Microsoft.AspNetCore.Hosting.FunctionalTests/ShutdownTests.cs index 8bc7059a73..b01b4481b9 100644 --- a/test/Microsoft.AspNetCore.Hosting.FunctionalTests/ShutdownTests.cs +++ b/test/Microsoft.AspNetCore.Hosting.FunctionalTests/ShutdownTests.cs @@ -5,7 +5,7 @@ using System.Diagnostics; using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Server.IntegrationTesting; -using Microsoft.AspNetCore.Server.IntegrationTesting.xunit; +using Microsoft.AspNetCore.Testing; using Microsoft.AspNetCore.Testing.xunit; using Microsoft.Extensions.Logging.Testing; using Xunit; @@ -28,7 +28,7 @@ namespace Microsoft.AspNetCore.Hosting.FunctionalTests { var logger = loggerFactory.CreateLogger(nameof(ShutdownTest)); - var applicationPath = Path.Combine(TestProjectHelpers.GetSolutionRoot(), "test", + var applicationPath = Path.Combine(TestPathUtilities.GetSolutionRootDirectory("Hosting"), "test", "Microsoft.AspNetCore.Hosting.TestSites"); var deploymentParameters = new DeploymentParameters(