diff --git a/src/Microsoft.TestPlatform.CrossPlatEngine/Hosting/DotnetTestHostManager.cs b/src/Microsoft.TestPlatform.CrossPlatEngine/Hosting/DotnetTestHostManager.cs index 4848d3110c..40cdb8d058 100644 --- a/src/Microsoft.TestPlatform.CrossPlatEngine/Hosting/DotnetTestHostManager.cs +++ b/src/Microsoft.TestPlatform.CrossPlatEngine/Hosting/DotnetTestHostManager.cs @@ -177,7 +177,7 @@ public virtual TestProcessStartInfo GetTestHostProcessStartInfo( // G:\tmp\netcore-test\bin\Debug\netcoreapp1.0\netcore-test.dll startInfo.Arguments = args; startInfo.EnvironmentVariables = environmentVariables ?? new Dictionary(); - startInfo.WorkingDirectory = Directory.GetCurrentDirectory(); + startInfo.WorkingDirectory = sourceDirectory; return startInfo; } diff --git a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Hosting/DotnetTestHostManagerTests.cs b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Hosting/DotnetTestHostManagerTests.cs index 6e9c7e9c7a..7038151ad4 100644 --- a/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Hosting/DotnetTestHostManagerTests.cs +++ b/test/Microsoft.TestPlatform.CrossPlatEngine.UnitTests/Hosting/DotnetTestHostManagerTests.cs @@ -257,14 +257,14 @@ public void GetTestHostProcessStartInfoShouldThrowExceptionWhenDotnetIsNotInstal } [TestMethod] - public void GetTestHostProcessStartInfoShouldIncludeCurrentDirectoryAsWorkingDirectory() + public void GetTestHostProcessStartInfoShouldIncludeSourceDirectoryAsWorkingDirectory() { // Absolute path to the source directory var sourcePath = Path.Combine($"{Path.DirectorySeparatorChar}tmp", "test.dll"); this.mockFileHelper.Setup(ph => ph.Exists(@"\tmp\testhost.dll")).Returns(true); var startInfo = this.dotnetHostManager.GetTestHostProcessStartInfo(new[] { sourcePath }, null, this.defaultConnectionInfo); - - Assert.AreEqual(Directory.GetCurrentDirectory(), startInfo.WorkingDirectory); + + Assert.AreEqual($"{Path.DirectorySeparatorChar}tmp", startInfo.WorkingDirectory); } [TestMethod]