From 8fa2d35291bde68ad2cd25529a15a61ff3720e43 Mon Sep 17 00:00:00 2001 From: Livar Cunha Date: Tue, 9 Aug 2016 15:33:48 -0700 Subject: [PATCH] Updating dotnet new test so that it does not use project dependencies and honors package dependencies. --- .../GivenThatIWantANewCSxUnitProject.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs b/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs index 20ec7c904..3aa000589 100644 --- a/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs +++ b/test/dotnet-new.Tests/GivenThatIWantANewCSxUnitProject.cs @@ -36,16 +36,20 @@ namespace Microsoft.DotNet.Tests [Fact] public void When_dotnet_test_is_invoked_Then_tests_run_without_errors() { + const string testFolder = "test"; var rootPath = Temp.CreateDirectory().Path; + var testDirectory = Directory.CreateDirectory(Path.Combine(rootPath, testFolder)).FullName; - new TestCommand("dotnet") { WorkingDirectory = rootPath } + File.WriteAllText(Path.Combine(rootPath, "global.json"), $"{{ \"projects\": [\"{testFolder}\"] }}"); + + new TestCommand("dotnet") { WorkingDirectory = testDirectory } .Execute("new --type xunittest"); - new TestCommand("dotnet") { WorkingDirectory = rootPath } + new TestCommand("dotnet") { WorkingDirectory = testDirectory } .Execute("restore"); var buildResult = new TestCommand("dotnet") - .WithWorkingDirectory(rootPath) + .WithWorkingDirectory(testDirectory) .ExecuteWithCapturedOutput("test") .Should() .Pass();