Updating path loading for .NET tests to support .NET Core
@@ -23,6 +23,7 @@ private EnvironmentManager()
string currentDirectory = this.CurrentDirectory;
string content = File.ReadAllText(Path.Combine(currentDirectory, "appconfig.json"));
TestEnvironment env = JsonConvert.DeserializeObject<TestEnvironment>(content);
+
string activeDriverConfig = TestContext.Parameters.Get("ActiveDriverConfig", env.ActiveDriverConfig);
string activeWebsiteConfig = TestContext.Parameters.Get("ActiveWebsiteConfig", env.ActiveWebsiteConfig);
string driverServiceLocation = TestContext.Parameters.Get("DriverServiceLocation", env.DriverServiceLocation);
@@ -55,9 +56,15 @@ private EnvironmentManager()
}
~EnvironmentManager()
+ {
+ if (remoteServer != null)
{
remoteServer.Stop();
+ }
+ if (webServer != null)
+ {
webServer.Stop();
+ }
if (driver != null)
{
driver.Quit();
@@ -78,7 +85,13 @@ public string CurrentDirectory
{
get
{
- return TestContext.CurrentContext.TestDirectory;
+ string assemblyLocation = Path.GetDirectoryName(typeof(EnvironmentManager).Assembly.Location);
+ string testDirectory = TestContext.CurrentContext.TestDirectory;
+ if (assemblyLocation != testDirectory)
+ {
+ return assemblyLocation;
+ }
+ return testDirectory;
}
}
