From 9263d63d2c87b65683edd8c0eb369932581cea1b Mon Sep 17 00:00:00 2001 From: BrennanConroy Date: Wed, 22 Jun 2016 15:20:09 -0700 Subject: [PATCH] Add net451 back so windows works and Unix skips net451 --- .../Helpers.cs | 21 +++++++++++++++++-- .../NtlmAuthenticationTest.cs | 3 +++ .../project.json | 2 ++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/test/ServerComparison.FunctionalTests/Helpers.cs b/test/ServerComparison.FunctionalTests/Helpers.cs index acb4240bf1..d53c638144 100644 --- a/test/ServerComparison.FunctionalTests/Helpers.cs +++ b/test/ServerComparison.FunctionalTests/Helpers.cs @@ -1,8 +1,10 @@ // 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; using Microsoft.AspNetCore.Server.Testing; +using Microsoft.Extensions.PlatformAbstractions; namespace ServerComparison.FunctionalTests { @@ -10,8 +12,23 @@ namespace ServerComparison.FunctionalTests { public static string GetApplicationPath(ApplicationType applicationType) { - return Path.GetFullPath(Path.Combine("..", - applicationType == ApplicationType.Standalone? "ServerComparison.TestSites.Standalone" : "ServerComparison.TestSites")); + var applicationBasePath = PlatformServices.Default.Application.ApplicationBasePath; + + var directoryInfo = new DirectoryInfo(applicationBasePath); + do + { + var solutionFileInfo = new FileInfo(Path.Combine(directoryInfo.FullName, "ServerTests.sln")); + if (solutionFileInfo.Exists) + { + var projectName = applicationType == ApplicationType.Standalone ? "ServerComparison.TestSites.Standalone" : "ServerComparison.TestSites"; + return Path.GetFullPath(Path.Combine(directoryInfo.FullName, "test", projectName)); + } + + directoryInfo = directoryInfo.Parent; + } + while (directoryInfo.Parent != null); + + throw new Exception($"Solution root could not be found using {applicationBasePath}"); } public static string GetConfigContent(ServerType serverType, string iisConfig, string nginxConfig) diff --git a/test/ServerComparison.FunctionalTests/NtlmAuthenticationTest.cs b/test/ServerComparison.FunctionalTests/NtlmAuthenticationTest.cs index e1d9ef859c..169dd2d2fa 100644 --- a/test/ServerComparison.FunctionalTests/NtlmAuthenticationTest.cs +++ b/test/ServerComparison.FunctionalTests/NtlmAuthenticationTest.cs @@ -1,5 +1,6 @@ // 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. +#if NET451 using System; using System.Net; @@ -132,3 +133,5 @@ namespace ServerComparison.FunctionalTests } } } + +#endif \ No newline at end of file diff --git a/test/ServerComparison.FunctionalTests/project.json b/test/ServerComparison.FunctionalTests/project.json index 1961db988f..3ed5c4bea1 100644 --- a/test/ServerComparison.FunctionalTests/project.json +++ b/test/ServerComparison.FunctionalTests/project.json @@ -15,6 +15,7 @@ "Microsoft.AspNetCore.Server.Testing": "0.2.0-*", "Microsoft.Extensions.Logging": "1.1.0-*", "Microsoft.Extensions.Logging.Console": "1.1.0-*", + "Microsoft.Extensions.PlatformAbstractions": "1.0.0-*", "Microsoft.Net.Http.Headers": "1.1.0-*" }, "publishOptions": { @@ -25,6 +26,7 @@ ] }, "frameworks": { + "net451": { }, "netcoreapp1.0": { "dependencies": { "Microsoft.NETCore.App": {