Skip to content
This repository was archived by the owner on Nov 22, 2018. It is now read-only.

Commit d42eb56

Browse files
committed
Fix content root for non-windows xunit tests with no app domains
1 parent 2477982 commit d42eb56

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/Microsoft.AspNetCore.StaticFiles.Tests/StaticFilesTestServer.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,16 @@
88
using Microsoft.AspNetCore.TestHost;
99
using Microsoft.Extensions.Configuration;
1010
using Microsoft.Extensions.DependencyInjection;
11+
using Microsoft.Extensions.PlatformAbstractions;
1112

1213
namespace Microsoft.AspNetCore.StaticFiles
1314
{
1415
public static class StaticFilesTestServer
1516
{
1617
public static TestServer Create(Action<IApplicationBuilder> configureApp, Action<IServiceCollection> configureServices = null)
1718
{
19+
var contentRootNet451 = PlatformServices.Default.Runtime.OperatingSystemPlatform == Platform.Windows ?
20+
"." : "../../../../test/Microsoft.AspNetCore.StaticFiles.Tests";
1821
Action<IServiceCollection> defaultConfigureServices = services => { };
1922
var configuration = new ConfigurationBuilder()
2023
.AddInMemoryCollection(new []
@@ -23,6 +26,9 @@ public static TestServer Create(Action<IApplicationBuilder> configureApp, Action
2326
})
2427
.Build();
2528
var builder = new WebHostBuilder()
29+
#if NET451
30+
.UseContentRoot(contentRootNet451)
31+
#endif
2632
.UseConfiguration(configuration)
2733
.Configure(configureApp)
2834
.ConfigureServices(configureServices ?? defaultConfigureServices);

0 commit comments

Comments
 (0)