コード例 #1
0
            public void Should_Throw_If_Candle_Runner_Was_Not_Found()
            {
                // Given
                var fixture = new CandleFixture();

                fixture.GivenDefaultToolDoNotExist();

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

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("Candle: Could not locate executable.", result.Message);
            }
コード例 #2
0
            public void Should_Throw_If_Source_Files_Is_Empty()
            {
                // Given
                var fixture = new CandleFixture();

                fixture.SourceFiles = new List <FilePath>();

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

                // Then
                Assert.IsType <ArgumentException>(result);
                Assert.Equal("sourceFiles", ((ArgumentException)result).ParamName);
            }
コード例 #3
0
            public void Should_Add_Defines_To_Arguments_If_Provided()
            {
                // Given
                var fixture = new CandleFixture();

                fixture.Settings.Defines = new Dictionary <string, string>();
                fixture.Settings.Defines.Add("Foo", "Bar");

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

                // Then
                Assert.Equal("-dFoo=Bar \"/Working/Test.wxs\"", result.Args);
            }
コード例 #4
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new CandleFixture();

                fixture.GivenProcessExitsWithCode(1);

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

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("Candle: Process returned an error (exit code 1).", result.Message);
            }
コード例 #5
0
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new CandleFixture();

                fixture.GivenProcessCannotStart();

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

                // Then
                Assert.IsType <CakeException>(result);
                Assert.Equal("Candle: Process was not started.", result.Message);
            }
コード例 #6
0
            public void Should_Use_Candle_Runner_From_Tool_Path_If_Provided_On_Windows(string toolPath, string expected)
            {
                // Given
                var fixture = new CandleFixture();

                fixture.Settings.ToolPath = toolPath;
                fixture.GivenSettingsToolPathExist();

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

                // Then
                Assert.Equal(expected, result.Path.FullPath);
            }
コード例 #7
0
            public void Should_Use_Provided_Source_Files_In_Process_Arguments()
            {
                // Given
                var fixture = new CandleFixture();

                fixture.SourceFiles.Clear();
                fixture.SourceFiles.Add("./Test.wxs");
                fixture.SourceFiles.Add("./Test2.wxs");

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

                // Then
                Assert.Equal("\"/Working/Test.wxs\" \"/Working/Test2.wxs\"", result.Args);
            }