public void Should_Find_ReSharperReports_Runner_If_Tool_Path_Not_Provided()
            {
                // Given
                var fixture = new ReSharperReportsRunnerFixture();

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

                // Then
                Assert.Equal("/Working/tools/ReSharperReports.exe", result.Path.FullPath);
            }
            public void Should_Use_ReSharperReports_Runner_From_Tool_Path_If_Provided_On_Windows(string toolPath, string expected)
            {
                // Given
                var fixture = new ReSharperReportsRunnerFixture { Settings = { ToolPath = toolPath } };
                fixture.GivenSettingsToolPathExist();

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

                // Then
                Assert.Equal(expected, result.Path.FullPath);
            }
            public void Should_Throw_If_Input_File_Is_Null()
            {
                // Given
                var fixture = new ReSharperReportsRunnerFixture();
                fixture.InputFilePath = null;

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsType<ArgumentNullException>(result);
                Assert.Equal("inputFilePath", ((ArgumentNullException)result).ParamName);
            }
            public void Should_Throw_If_ReSharperReports_Runner_Was_Not_Found()
            {
                // Given
                var fixture = new ReSharperReportsRunnerFixture();
                fixture.GivenDefaultToolDoNotExist();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsType<CakeException>(result);
                Assert.Equal("ReSharperReports: Could not locate executable.", result.Message);
            }
            public void Should_Set_Log_File()
            {
                // Given
                var fixture = new ReSharperReportsRunnerFixture { Settings = { LogFilePath = "C:/temp/output.log" } };

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

                // Then
                Assert.Equal("transform -i \"c:/temp/input.xml\" -o \"c:/temp/output.html\" -l \"C:/temp/output.log\"", result.Args);
            }
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new ReSharperReportsRunnerFixture();
                fixture.GivenProcessExitsWithCode(1);

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsType<CakeException>(result);
                Assert.Equal("ReSharperReports: Process returned an error (exit code 1).", result.Message);
            }
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new ReSharperReportsRunnerFixture();
                fixture.GivenProcessCannotStart();

                // When
                var result = Record.Exception(() => fixture.Run());

                // Then
                Assert.IsType<CakeException>(result);
                Assert.Equal("ReSharperReports: Process was not started.", result.Message);
            }
            public void Should_Set_Working_Directory()
            {
                // Given
                var fixture = new ReSharperReportsRunnerFixture();

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

                // Then
                Assert.Equal("/Working", result.Process.WorkingDirectory.FullPath);
            }