File tree Expand file tree Collapse file tree 2 files changed +18
-19
lines changed
src/Microsoft.AspNetCore.Server.IntegrationTesting/xunit
test/Microsoft.AspNetCore.Hosting.FunctionalTests Expand file tree Collapse file tree 2 files changed +18
-19
lines changed Original file line number Diff line number Diff line change @@ -9,24 +9,27 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.xunit
9
9
{
10
10
public class TestProjectHelpers
11
11
{
12
- public static string GetProjectRoot ( )
13
- {
14
- var applicationBasePath = PlatformServices . Default . Application . ApplicationBasePath ;
12
+ private const string SolutionName = "Hosting.sln" ;
15
13
16
- var directoryInfo = new DirectoryInfo ( applicationBasePath ) ;
17
- do
18
- {
19
- var projectFileInfo = new FileInfo ( Path . Combine ( directoryInfo . FullName , "project.json" ) ) ;
20
- if ( projectFileInfo . Exists )
21
- {
22
- return projectFileInfo . DirectoryName ;
23
- }
14
+ public static string GetSolutionRoot ( )
15
+ {
16
+ var applicationName = PlatformServices . Default . Application . ApplicationName ;
17
+ var applicationBasePath = PlatformServices . Default . Application . ApplicationBasePath ;
24
18
25
- directoryInfo = directoryInfo . Parent ;
19
+ var directoryInfo = new DirectoryInfo ( applicationBasePath ) ;
20
+ do
21
+ {
22
+ var projectFileInfo = new FileInfo ( Path . Combine ( directoryInfo . FullName , SolutionName ) ) ;
23
+ if ( projectFileInfo . Exists )
24
+ {
25
+ return projectFileInfo . DirectoryName ;
26
26
}
27
- while ( directoryInfo . Parent != null ) ;
28
27
29
- throw new Exception ( $ "Project root could not be found using { applicationBasePath } " ) ;
28
+ directoryInfo = directoryInfo . Parent ;
30
29
}
30
+ while ( directoryInfo . Parent != null ) ;
31
+
32
+ throw new Exception ( $ "Solution file { SolutionName } could not be found using { applicationBasePath } ") ;
31
33
}
32
34
}
35
+ }
Original file line number Diff line number Diff line change 1
1
// Copyright (c) .NET Foundation. All rights reserved.
2
2
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
3
3
4
- using System ;
5
4
using System . Diagnostics ;
6
5
using System . IO ;
7
- using System . Net . Http ;
8
- using System . Threading . Tasks ;
9
6
using Microsoft . AspNetCore . Server . IntegrationTesting ;
10
7
using Microsoft . AspNetCore . Server . IntegrationTesting . xunit ;
11
8
using Microsoft . AspNetCore . Testing . xunit ;
12
9
using Microsoft . Extensions . Logging ;
13
10
using Xunit ;
14
- using Xunit . Sdk ;
15
11
16
12
namespace Microsoft . AspNetCore . Hosting . FunctionalTests
17
13
{
@@ -26,7 +22,7 @@ public void ShutdownTest()
26
22
. AddConsole ( )
27
23
. CreateLogger ( nameof ( ShutdownTest ) ) ;
28
24
29
- string applicationPath = Path . Combine ( TestProjectHelpers . GetProjectRoot ( ) , ".. " ,
25
+ var applicationPath = Path . Combine ( TestProjectHelpers . GetSolutionRoot ( ) , "test " ,
30
26
"Microsoft.AspNetCore.Hosting.TestSites" ) ;
31
27
32
28
var deploymentParameters = new DeploymentParameters (
You can’t perform that action at this time.
0 commit comments