示例#1
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");
            }
示例#2
0
            public void Should_Throw_If_Fixie_Runner_Was_Not_Found()
            {
                // Given
                var fixture = new FixieRunnerFixture(defaultToolExist: false);
                var runner  = fixture.CreateRunner();

                // When
                var result = Record.Exception(() => runner.Run("./Test1.dll", new FixieSettings()));

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("Fixie: Could not locate executable.", result.Message);
            }
示例#3
0
            public void Should_Find_Fixie_Runner_If_Tool_Path_Not_Provided()
            {
                // Given
                var fixture = new FixieRunnerFixture();
                var runner  = fixture.CreateRunner();

                // When
                runner.Run("./Test1.dll", new FixieSettings());

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == "/Working/tools/Fixie.Console.exe"),
                    Arg.Any <ProcessSettings>());
            }
示例#4
0
            public void Should_Use_Provided_Assembly_Path_In_Process_Arguments()
            {
                // 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.Arguments.Render() == "\"/Working/Test1.dll\""));
            }
示例#5
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);
            }
示例#6
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);
            }
示例#7
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"));
            }
示例#8
0
            public void Should_Use_Fixie_Runner_From_Tool_Path_If_Provided(string toolPath, string expected)
            {
                // Given
                var fixture = new FixieRunnerFixture(expected);
                var runner  = fixture.CreateRunner();

                // When
                runner.Run("./Test1.dll", new FixieSettings
                {
                    ToolPath = toolPath
                });

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Is <FilePath>(p => p.FullPath == expected),
                    Arg.Any <ProcessSettings>());
            }
示例#9
0
            public void Should_Set_Custom_Options()
            {
                // Given
                var fixture = new FixieRunnerFixture();
                var runner  = fixture.CreateRunner();

                // When
                runner.Run("./Tests.dll", new FixieSettings()
                           .WithOption("--include", "CategoryA")
                           .WithOption("--include", "CategoryB"));

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any <FilePath>(),
                    Arg.Is <ProcessSettings>(
                        p => p.Arguments.Render() == string.Format("\"/Working/Tests.dll\" --include CategoryA --include CategoryB")));
            }
示例#10
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)));
            }
示例#11
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\""));
            }
示例#12
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"));
            }