Fix tests broken during conversion
This commit is contained in:
parent
f513f8ceac
commit
056a251b8c
|
|
@ -9,24 +9,27 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.xunit
|
|||
{
|
||||
public class TestProjectHelpers
|
||||
{
|
||||
public static string GetProjectRoot()
|
||||
private const string SolutionName = "Hosting.sln";
|
||||
|
||||
public static string GetSolutionRoot()
|
||||
{
|
||||
var applicationName = PlatformServices.Default.Application.ApplicationName;
|
||||
var applicationBasePath = PlatformServices.Default.Application.ApplicationBasePath;
|
||||
|
||||
var directoryInfo = new DirectoryInfo(applicationBasePath);
|
||||
do
|
||||
{
|
||||
var applicationBasePath = PlatformServices.Default.Application.ApplicationBasePath;
|
||||
|
||||
var directoryInfo = new DirectoryInfo(applicationBasePath);
|
||||
do
|
||||
var projectFileInfo = new FileInfo(Path.Combine(directoryInfo.FullName, SolutionName));
|
||||
if (projectFileInfo.Exists)
|
||||
{
|
||||
var projectFileInfo = new FileInfo(Path.Combine(directoryInfo.FullName, "project.json"));
|
||||
if (projectFileInfo.Exists)
|
||||
{
|
||||
return projectFileInfo.DirectoryName;
|
||||
}
|
||||
|
||||
directoryInfo = directoryInfo.Parent;
|
||||
return projectFileInfo.DirectoryName;
|
||||
}
|
||||
while (directoryInfo.Parent != null);
|
||||
|
||||
throw new Exception($"Project root could not be found using {applicationBasePath}");
|
||||
directoryInfo = directoryInfo.Parent;
|
||||
}
|
||||
while (directoryInfo.Parent != null);
|
||||
|
||||
throw new Exception($"Solution file {SolutionName} could not be found using {applicationBasePath}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,17 +1,13 @@
|
|||
// 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.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting;
|
||||
using Microsoft.AspNetCore.Server.IntegrationTesting.xunit;
|
||||
using Microsoft.AspNetCore.Testing.xunit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Xunit;
|
||||
using Xunit.Sdk;
|
||||
|
||||
namespace Microsoft.AspNetCore.Hosting.FunctionalTests
|
||||
{
|
||||
|
|
@ -26,7 +22,7 @@ namespace Microsoft.AspNetCore.Hosting.FunctionalTests
|
|||
.AddConsole()
|
||||
.CreateLogger(nameof(ShutdownTest));
|
||||
|
||||
string applicationPath = Path.Combine(TestProjectHelpers.GetProjectRoot(), "..",
|
||||
var applicationPath = Path.Combine(TestProjectHelpers.GetSolutionRoot(), "test",
|
||||
"Microsoft.AspNetCore.Hosting.TestSites");
|
||||
|
||||
var deploymentParameters = new DeploymentParameters(
|
||||
|
|
|
|||
Loading…
Reference in New Issue