public void Should_Set_Switches_For_MethodNameToInclude_Defined_In_Settings() { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.IncludeMethod("Company.Product.Feature.ClassName.MethodName"); // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" -method \"Company.Product.Feature.ClassName.MethodName\"", result.Args); }
public void Should_Not_Use_Shadow_Copying_If_Disabled_In_Settings() { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.ShadowCopy = false; // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" -noshadow", result.Args); }
public void Should_Not_Use_App_Domains_If_Disabled_In_Settings() { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.NoAppDomain = true; // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" -noappdomain", result.Args); }
public void Should_Use_Provided_Assembly_Paths_In_Process_Arguments() { // Given var fixture = new XUnit2RunnerFixture(); fixture.AssemblyPaths = new FilePath[] { "./Test1.dll", "./Test2.dll" }; // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" \"/Working/Test2.dll\"", result.Args); }
public void Should_Throw_If_Assembly_Path_Is_Null() { // Given var fixture = new XUnit2RunnerFixture(); fixture.AssemblyPaths = null; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsArgumentNullException(result, "assemblyPaths"); }
public void Should_Use_MaxThreads_Switch_If_Settings_Value_Is_Not_Null(int?option, string expected) { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.MaxThreads = option; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Use_Parallel_Switch_If_Settings_Value_Is_Not_None(ParallelismOption option, string expected) { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.Parallelism = option; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Find_XUnit_X86_Runner_If_Tool_Path_Not_Provided() { // Given var fixture = new XUnit2RunnerFixture("xunit.console.x86.exe"); fixture.Settings.UseX86 = true; // When var result = fixture.Run(); // Then Assert.Equal("/Working/tools/xunit.console.x86.exe", result.Path.FullPath); }
public void Should_Generate_NUnit_Xml_Report_With_Correct_Name_For_Single_Assembly() { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.OutputDirectory = "/Output"; fixture.Settings.NUnitReport = true; // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" -nunit \"/Output/Test1.dll.xml\"", result.Args); }
public void Should_Throw_If_NUnitReport_Is_Set_But_OutputDirectory_Is_Null() { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.NUnitReport = true; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("Cannot generate NUnit XML report when no output directory has been set.", result?.Message); }
public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code() { // Given var fixture = new XUnit2RunnerFixture(); fixture.GivenProcessExitsWithCode(1); // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("xUnit.net (v2): Process returned an error (exit code 1).", result?.Message); }
public void Should_Throw_If_Process_Was_Not_Started() { // Given var fixture = new XUnit2RunnerFixture(); fixture.GivenProcessCannotStart(); // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("xUnit.net (v2): Process was not started.", result?.Message); }
public void Should_Throw_If_XUnit_X86_Flag_Is_Not_Set_To_True() { // Given var fixture = new XUnit2RunnerFixture("xunit.console.x86.exe"); fixture.Settings.UseX86 = false; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("xUnit.net (v2): Could not locate executable.", result?.Message); }
public void Should_Generate_Legacy_Xml_Report_If_Enabled_In_Settings() { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.OutputDirectory = "/Output"; fixture.Settings.XmlReportV1 = true; // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" -xmlv1 \"/Output/Test1.dll.xml\"", result.Args); }
public void Should_Throw_If_XUnit_Runner_Was_Not_Found() { // Given var fixture = new XUnit2RunnerFixture(); fixture.GivenDefaultToolDoNotExist(); // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("xUnit.net (v2): Could not locate executable.", result?.Message); }
public void Should_Use_XUnit_Runner_From_Tool_Path_If_Provided_On_Windows(string toolPath, string expected) { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.ToolPath = toolPath; fixture.GivenSettingsToolPathExist(); // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Path.FullPath); }
public void Should_Set_Switches_For_TraitsToExclude_Defined_In_Settings() { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.ExcludeTrait("Trait1", "value1A", "value1B"); fixture.Settings.ExcludeTrait("Trait2", "value2"); // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" -notrait \"Trait1=value1A\" -notrait \"Trait1=value1B\" -notrait \"Trait2=value2\"", result.Args); }
public void Should_Generate_Legacy_Xml_Report_With_Correct_Name_For_Single_Assembly_ReportName() { // Given var fixture = new XUnit2RunnerFixture(); fixture.Settings.OutputDirectory = "/Output"; fixture.Settings.XmlReportV1 = true; fixture.Settings.ReportName = "xUnitReport"; // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" -xmlv1 \"/Output/xUnitReport.xml\"", result.Args); }
public void Should_Generate_NUnit_Xml_Report_With_Correct_Name_For_Multiple_Assemblies() { // Given var fixture = new XUnit2RunnerFixture(); fixture.AssemblyPaths = new FilePath[] { "./Test1.dll", "./Test2.dll" }; fixture.Settings.OutputDirectory = "/Output"; fixture.Settings.NUnitReport = true; // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" \"/Working/Test2.dll\" " + "-nunit \"/Output/TestResults.xml\"", result.Args); }