Exemple #1
0
            public void ShouldThrowIfProcessHasANonZeroExitCode(
                [Frozen] IProcess process,
                [Frozen] IFileSystem fileSystem, ChutzpahRunner sut)
            {
                fileSystem.Exist(Arg.Any <FilePath>()).Returns(true);
                process.GetExitCode().Returns(3);

                sut.Invoking(s => s.Run())
                .ShouldThrow <CakeException>()
                .WithMessage("Chutzpah: Process returned an error (exit code 3).");
            }
            public void ShouldThrowIfProcessHasANonZeroExitCode(
                [Frozen] IProcess process,
                [Frozen] IFileSystem fileSystem, ChutzpahRunner sut)
            {
                fileSystem.Exist(Arg.Any<FilePath>()).Returns(true);
                process.GetExitCode().Returns(3);

                sut.Invoking(s => s.Run())
                    .ShouldThrow<CakeException>()
                    .WithMessage("Chutzpah: Process returned an error (exit code 3).");
            }
Exemple #3
0
            public void ShouldThrowIfProcessWasNotStarted([Frozen] ICakeEnvironment environment,
                                                          [Frozen] IProcessRunner processRunner,
                                                          [Frozen] IFileSystem fileSystem, ChutzpahRunner sut)
            {
                environment.WorkingDirectory.Returns("/Working");
                fileSystem.Exist(Arg.Any <FilePath>()).Returns(true);
                processRunner.Start(Arg.Any <FilePath>(), Arg.Any <ProcessSettings>())
                .Returns((IProcess)null);

                sut.Invoking(s => s.Run())
                .ShouldThrow <CakeException>()
                .WithMessage("Chutzpah: Process was not started.");
            }
            public void ShouldThrowIfProcessWasNotStarted([Frozen] ICakeEnvironment environment,
                [Frozen] IProcessRunner processRunner,
                [Frozen] IFileSystem fileSystem, ChutzpahRunner sut)
            {
                environment.WorkingDirectory.Returns("/Working");
                fileSystem.Exist(Arg.Any<FilePath>()).Returns(true);
                processRunner.Start(Arg.Any<FilePath>(), Arg.Any<ProcessSettings>())
                    .Returns((IProcess)null);

                sut.Invoking(s => s.Run())
                    .ShouldThrow<CakeException>()
                    .WithMessage("Chutzpah: Process was not started.");
            }
Exemple #5
0
            public void ShouldThrowIfChutzpahExecutableNotFound(
                [Frozen] ICakeEnvironment environment, [Frozen] IFileSystem fileSystem, [Frozen] IToolLocator tools,
                ChutzpahRunner sut)
            {
                environment.WorkingDirectory.Returns("/Working");
                tools.Resolve(Arg.Any <string>()).Returns(null as FilePath);
                fileSystem.Exist(
                    Arg.Is <FilePath>(a => a.FullPath.Contains("chutzpah.console.exe")))
                .Returns(false);

                sut.Invoking(x => x.Run())
                .ShouldThrow <CakeException>()
                .WithMessage("Chutzpah: Could not locate executable.");
            }
            public void ShouldThrowIfChutzpahExecutableNotFound(
                [Frozen] ICakeEnvironment environment, [Frozen] IFileSystem fileSystem,
                ChutzpahRunner sut)
            {
                environment.WorkingDirectory.Returns("/Working");
                fileSystem.Exist(
                    Arg.Is<FilePath>(a => a.FullPath.Contains("chutzpah.console.exe")))
                    .Returns(false);

                sut.Invoking(x => x.Run())
                    .ShouldThrow<CakeException>()
                    .WithMessage("Chutzpah: Could not locate executable.");
            }