public void Should_Set_Working_Directory() { // Given var fixture = new FixieRunnerFixture(); // When var result = fixture.Run(); // Then Assert.Equal("/Working", result.Process.WorkingDirectory.FullPath); }
public void Should_Find_Fixie_Runner_If_Tool_Path_Not_Provided() { // Given var fixture = new FixieRunnerFixture(); // When var result = fixture.Run(); // Then Assert.Equal("/Working/tools/Fixie.Console.exe", result.Path.FullPath); }
public void Should_Use_Provided_Assembly_Path_In_Process_Arguments() { // Given var fixture = new FixieRunnerFixture(); // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\"", result.Args); }
public void Should_Throw_If_Assembly_Path_Is_Null() { // Given var fixture = new FixieRunnerFixture(); var runner = fixture.CreateRunner(); // When var result = Record.Exception(() => runner.Run((FilePath)null, new FixieSettings())); // Then Assert.IsArgumentNullException(result, "assemblyPath"); }
public void Should_Set_TeamCity_Value(bool teamCityOutput, string teamCityValue, string expected) { // Given var fixture = new FixieRunnerFixture(); fixture.Settings.TeamCity = teamCityOutput; // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Args); }
public void Should_Throw_If_Assembly_Paths_Are_Null() { // Given var fixture = new FixieRunnerFixture(); fixture.AssemblyPaths = null; // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsArgumentNullException(result, "assemblyPaths"); }
public void Should_Use_Fixie_Runner_From_Tool_Path_If_Provided_On_Windows(string toolPath, string expected) { // Given var fixture = new FixieRunnerFixture(); fixture.Settings.ToolPath = toolPath; fixture.GivenSettingsToolPathExist(); // When var result = fixture.Run(); // Then Assert.Equal(expected, result.Path.FullPath); }
public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code() { // Given var fixture = new FixieRunnerFixture(); fixture.GivenProcessExitsWithCode(1); // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("Fixie: Process returned an error (exit code 1).", result.Message); }
public void Should_Throw_If_Process_Was_Not_Started() { // Given var fixture = new FixieRunnerFixture(); fixture.GivenProcessCannotStart(); // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("Fixie: Process was not started.", result.Message); }
public void Should_Throw_If_Fixie_Runner_Was_Not_Found() { // Given var fixture = new FixieRunnerFixture(); fixture.GivenDefaultToolDoNotExist(); // When var result = Record.Exception(() => fixture.Run()); // Then Assert.IsType <CakeException>(result); Assert.Equal("Fixie: Could not locate executable.", result.Message); }
public void Should_Set_xUnitXml_Output_File() { // Given var fixture = new FixieRunnerFixture(); fixture.Settings.XUnitXml = "xunit-results.xml"; // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" " + "--xUnitXml \"/Working/xunit-results.xml\"", result.Args); }
public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code() { // Given var fixture = new FixieRunnerFixture(); fixture.Process.GetExitCode().Returns(1); var runner = fixture.CreateRunner(); // When var result = Record.Exception(() => runner.Run("./Test1.dll", new FixieSettings())); // Then Assert.IsType <CakeException>(result); Assert.Equal("Fixie: Process returned an error.", result.Message); }
public void Should_Set_Working_Directory() { // Given var fixture = new FixieRunnerFixture(); var runner = fixture.CreateRunner(); // When runner.Run("./Test1.dll", new FixieSettings()); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>( p => p.WorkingDirectory.FullPath == "/Working")); }
public void Should_Throw_If_Process_Was_Not_Started() { // Given var fixture = new FixieRunnerFixture(); fixture.ProcessRunner.Start(Arg.Any <FilePath>(), Arg.Any <ProcessSettings>()).Returns((IProcess)null); var runner = fixture.CreateRunner(); // When var result = Record.Exception(() => runner.Run("./Test1.dll", new FixieSettings())); // Then Assert.IsType <CakeException>(result); Assert.Equal("Fixie: Process was not started.", result.Message); }
public void Should_Set_Custom_Options() { // Given var fixture = new FixieRunnerFixture(); fixture.Settings.WithOption("--include", "CategoryA"); fixture.Settings.WithOption("--include", "CategoryB"); // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" " + "--include CategoryA " + "--include CategoryB", result.Args); }
public void Should_Set_Multiple_Options() { // Given var fixture = new FixieRunnerFixture(); fixture.Settings.WithOption("--type", "fast"); fixture.Settings.WithOption("--include", "CategoryA", "CategoryB"); fixture.Settings.WithOption("--output", "fixie-log.txt"); // When var result = fixture.Run(); // Then Assert.Equal("\"/Working/Test1.dll\" --type fast " + "--include CategoryA --include CategoryB " + "--output fixie-log.txt", result.Args); }
public void Should_Set_xUnitXml_Output_File() { // Given var fixture = new FixieRunnerFixture(); var runner = fixture.CreateRunner(); // When runner.Run("./blarg.dll", new FixieSettings { XUnitXml = "xunit-results.xml", }); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>(p => p.Arguments.Render() == "\"/Working/blarg.dll\" --xUnitXml \"/Working/xunit-results.xml\"")); }
public void Should_Set_TeamCity_Value(TeamCityOutput?teamCityOutput, string teamCityValue) { // Given var fixture = new FixieRunnerFixture(); var runner = fixture.CreateRunner(); // When runner.Run("./Tests.dll", new FixieSettings { TeamCity = teamCityOutput, }); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>( p => p.Arguments.Render() == string.Format("\"/Working/Tests.dll\" --TeamCity {0}", teamCityValue))); }
public void Should_Set_Multiple_Options() { // Given var fixture = new FixieRunnerFixture(); var runner = fixture.CreateRunner(); // When runner.Run("./Tests.dll", new FixieSettings() .WithOption("--type", "fast") .WithOption("--include", "CategoryA", "CategoryB") .WithOption("--output", "fixie-log.txt")); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>( p => p.Arguments.Render() == "\"/Working/Tests.dll\" --type fast --include CategoryA --include CategoryB --output fixie-log.txt")); }