示例#1
0
            public void Should_Set_Working_Directory()
            {
                // Given
                var fixture = new FixieRunnerFixture();

                // When
                var result = fixture.Run();

                // Then
                Assert.Equal("/Working", result.Process.WorkingDirectory.FullPath);
            }
示例#2
0
            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);
            }
示例#3
0
            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);
            }
示例#4
0
            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");
            }
示例#5
0
            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);
            }
示例#6
0
            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");
            }
示例#7
0
            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);
            }
示例#8
0
            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);
            }
示例#9
0
            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);
            }
示例#10
0
            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);
            }
示例#11
0
            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);
            }
示例#12
0
            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);
            }
示例#13
0
            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"));
            }
示例#14
0
            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);
            }
示例#15
0
            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);
            }
示例#16
0
            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);
            }
示例#17
0
            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\""));
            }
示例#18
0
            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)));
            }
示例#19
0
            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"));
            }