From bc8047e19fd67ae880a3f6876a82501fdd02a994 Mon Sep 17 00:00:00 2001 From: Sarabjot Singh Date: Thu, 5 Jan 2017 22:38:29 +0530 Subject: [PATCH] Fixed the working directory for the dotnet.exe to source directory. Fixed the unit test. --- .../Hosting/DotnetTestHostManager.cs | 2 +- .../Hosting/DotnetTestHostManagerTests.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) 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]