public void When_dotnet_build_is_invoked_Then_project_builds_without_warnings() { var rootPath = Temp.CreateDirectory().Path; new TestCommand("dotnet") { WorkingDirectory = rootPath } .Execute("new"); new TestCommand("dotnet") { WorkingDirectory = rootPath } .Execute("restore"); var buildResult = new TestCommand("dotnet") { WorkingDirectory = rootPath } .ExecuteWithCapturedOutput("build"); buildResult.Should().Pass(); buildResult.Should().NotHaveStdErr(); }
public void When_dotnet_new_is_invoked_mupliple_times_it_should_fail() { var rootPath = Temp.CreateDirectory().Path; new TestCommand("dotnet") { WorkingDirectory = rootPath } .Execute("new"); DateTime expectedState = Directory.GetLastWriteTime(rootPath); var result = new TestCommand("dotnet") { WorkingDirectory = rootPath } .ExecuteWithCapturedOutput("new"); DateTime actualState = Directory.GetLastWriteTime(rootPath); Assert.Equal(expectedState, actualState); result.Should().Fail(); result.Should().HaveStdErr(); }
private void Test(IEnumerable<string> inputs, IEnumerable<string> expectedProjects, string workingDirectory = null, [CallerMemberName] string testName = null) { var instance = TestAssetsManager.CreateTestInstance("TestProjectToProjectDependencies", testName) .WithLockFiles() .WithBuildArtifacts(); string args = string.Join(" ", inputs); workingDirectory = workingDirectory != null ? Path.Combine(instance.TestRoot, workingDirectory) : instance.TestRoot; var result = new TestCommand("dotnet") { WorkingDirectory = Path.Combine(workingDirectory) }.ExecuteWithCapturedOutput("--verbose build --no-dependencies " + args); if (expectedProjects != null) { result.Should().Pass(); foreach (var expectedProject in expectedProjects) { result.Should().HaveSkippedProjectCompilation(expectedProject, NuGetFramework.Parse("netstandard1.5").DotNetFrameworkName); } } else { result.Should().Fail(); } }