public void Should_Add_Additional_Settings() { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Settings.NoBuild = true; fixture.Settings.NoRestore = true; fixture.Settings.NoLogo = true; fixture.Settings.Framework = "dnxcore50"; fixture.Settings.Configuration = "Release"; fixture.Settings.Collectors = new[] { "XPlat Code Coverage" }; fixture.Settings.OutputDirectory = "./artifacts/"; fixture.Settings.Settings = "./demo.runsettings"; fixture.Settings.Filter = "Priority = 1"; fixture.Settings.TestAdapterPath = @"/Working/custom-test-adapter"; #pragma warning disable CS0618 fixture.Settings.Logger = "trx;LogFileName=/Working/logfile.trx"; #pragma warning restore CS0618 fixture.Settings.Loggers = new[] { "html;LogFileName=/Working/logfile.html" }; fixture.Settings.DiagnosticFile = "./artifacts/logging/diagnostics.txt"; fixture.Settings.ResultsDirectory = "./tests/"; fixture.Settings.VSTestReportPath = "./tests/TestResults.xml"; fixture.Settings.Runtime = "win-x64"; // When var result = fixture.Run(); // Then Assert.Equal("test --settings \"/Working/demo.runsettings\" --filter \"Priority = 1\" --test-adapter-path \"/Working/custom-test-adapter\" --logger \"trx;LogFileName=/Working/logfile.trx\" --logger \"html;LogFileName=/Working/logfile.html\" --output \"/Working/artifacts\" --framework dnxcore50 --configuration Release --collect \"XPlat Code Coverage\" --diag \"/Working/artifacts/logging/diagnostics.txt\" --no-build --no-restore --nologo --results-directory \"/Working/tests\" --logger trx;LogFileName=\"/Working/tests/TestResults.xml\" --runtime win-x64", result.Args); }
public void Should_Add_Mandatory_Arguments() { // Given var fixture = new DotNetCoreTesterFixture(); // When var result = fixture.Run(); // Then Assert.Equal("test", result.Args); }
public void Should_Add_Path() { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Project = "./test/Project.Tests/"; // When var result = fixture.Run(); // Then Assert.Equal("test ./test/Project.Tests/", result.Args); }
public void Should_Quote_Project_Path(string text, string expected) { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Project = text; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Add_Host_Arguments() { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Settings.DiagnosticOutput = true; // When var result = fixture.Run(); // Then Assert.Equal("--diagnostics test", result.Args); }
public void Should_Add_RunSettings_Arguments() { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Arguments = "MSTest.MapInconclusiveToFailed=true"; // When var result = fixture.Run(); // Then Assert.Equal("test -- MSTest.MapInconclusiveToFailed=true", result.Args); }
public void Should_Add_RunSettings_Arguments() { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Arguments = new[] { "MSTest.DeploymentEnabled=false", "MSTest.MapInconclusiveToFailed=true" }.ToProcessArguments(); // When var result = fixture.Run(); // Then Assert.Equal("test -- MSTest.DeploymentEnabled=false MSTest.MapInconclusiveToFailed=true", result.Args); }
public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code() { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Project = "./src/*"; fixture.GivenProcessExitsWithCode(1); // When var result = Record.Exception(() => fixture.Run()); // Then AssertEx.IsCakeException(result, ".NET Core CLI: Process returned an error (exit code 1)."); }
public void Should_Throw_If_Process_Was_Not_Started() { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Project = "./src/*"; fixture.GivenProcessCannotStart(); // When var result = Record.Exception(() => fixture.Run()); // Then AssertEx.IsCakeException(result, ".NET Core CLI: Process was not started."); }
public void Should_Throw_If_Settings_Are_Null() { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Project = "./src/*"; fixture.Settings = null; fixture.GivenDefaultToolDoNotExist(); // When var result = Record.Exception(() => fixture.Run()); // Then AssertEx.IsArgumentNullException(result, "settings"); }
public void Should_Add_Additional_Settings() { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Settings.BuildBasePath = "./temp/"; fixture.Settings.NoBuild = true; fixture.Settings.Framework = "dnxcore50"; fixture.Settings.Runtime = "runtime1"; fixture.Settings.Configuration = "Release"; fixture.Settings.OutputDirectory = "./artifacts/"; // When var result = fixture.Run(); // Then Assert.Equal("test --output \"/Working/artifacts\" --build-base-path \"/Working/temp\" --runtime runtime1 --framework dnxcore50 --configuration Release --no-build", result.Args); }
public void Should_Add_Additional_Settings() { // Given var fixture = new DotNetCoreTesterFixture(); fixture.Settings.NoBuild = true; fixture.Settings.Framework = "dnxcore50"; fixture.Settings.Configuration = "Release"; fixture.Settings.OutputDirectory = "./artifacts/"; fixture.Settings.Settings = "./demo.runsettings"; fixture.Settings.Filter = "Priority = 1"; fixture.Settings.TestAdapterPath = @"/Working/custom-test-adapter"; fixture.Settings.Logger = @"trx;LogFileName=/Working/logfile.trx"; fixture.Settings.DiagnosticFile = "./artifacts/logging/diagnostics.txt"; // When var result = fixture.Run(); // Then Assert.Equal("test --settings \"/Working/demo.runsettings\" --filter \"Priority = 1\" --test-adapter-path \"/Working/custom-test-adapter\" --logger \"trx;LogFileName=/Working/logfile.trx\" --output \"/Working/artifacts\" --framework dnxcore50 --configuration Release --diag \"/Working/artifacts/logging/diagnostics.txt\" --no-build", result.Args); }