示例#1
0
            public void Should_Throw_If_Unity_Is_Not_Installed()
            {
                // Given
                var fixture = new UnityRunnerFixture();
                fixture.DefaultToolPathExist = false;

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

                // Then
                Assert.IsType<CakeException>(result);
                Assert.Equal("Unity: Could not locate executable.", result.Message);
            }
示例#2
0
            public void Should_Throw_If_Project_Path_Do_Not_Exist()
            {
                // Given
                var fixture = new UnityRunnerFixture();
                fixture.ProjectPathExist = false;

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

                // Then
                Assert.IsType<CakeException>(result);
                Assert.Equal("The Unity project C:/Project do not exist.", result.Message);
            }
示例#3
0
            public void Should_Throw_If_Platform_Is_Null()
            {
                // Given
                var fixture = new UnityRunnerFixture();
                fixture.Platform = null;

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

                // Then
                Assert.IsType<ArgumentNullException>(result);
                Assert.Equal("platform", ((ArgumentNullException)result).ParamName);
            }
示例#4
0
            public void Should_Set_Default_Arguments()
            {
                // Given
                var fixture = new UnityRunnerFixture();

                // When
                fixture.ExecuteRunner();

                // Then
                fixture.ProcessRunner.Received(1).Start(
                    Arg.Any<FilePath>(),
                    Arg.Is<ProcessSettings>(p =>
                    p.Arguments.Render() == "-batchmode -quit -projectPath \"C:/Project\""));
            }
示例#5
0
            public void Should_Throw_If_Process_Has_A_Non_Zero_Exit_Code()
            {
                // Given
                var fixture = new UnityRunnerFixture();
                fixture.Process.GetExitCode().Returns(1);

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

                // Then
                Assert.IsType<CakeException>(result);
                Assert.Equal("Unity: Process returned an error.", result.Message);
            }
示例#6
0
            public void Should_Throw_If_Process_Was_Not_Started()
            {
                // Given
                var fixture = new UnityRunnerFixture();
                fixture.ProcessRunner.Start(Arg.Any<FilePath>(), Arg.Any<ProcessSettings>()).Returns((IProcess)null);

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

                // Then
                Assert.IsType<CakeException>(result);
                Assert.Equal("Unity: Process was not started.", result.Message);
            }