public void GivenExecutableThatExitsWithCodeOne__WhenCallingRun__ShouldThrowProcessFailedException() { ProcessRunnerStub runner = new ProcessRunnerStub { ExitCode = 1 }; RunProcessTask sut = new RunProcessTask(runner, _filesystem) { ExecutablePath = _executablePath }; sut.Run(); }
public void GivenFailingProcessButAllowedToFail__WhenCallingRun__ShouldNotThrowProcessFailedException() { ProcessRunnerStub runner = new ProcessRunnerStub { ExitCode = 1 }; RunProcessTask sut = new RunProcessTask(runner, _filesystem) { ExecutablePath = _executablePath, AllowedToFail = true }; sut.Run(); }
GivenPathToExecutable__WhenCallingRun__ShouldCallStartFirst_Then_BlockUntilFinished_Then_CheckExitCode() { CallOrderVerifyingProcessRunnerMock runner = new CallOrderVerifyingProcessRunnerMock(); const string executablePath = "myProgram.exe"; RunProcessTask sut = new RunProcessTask(runner, _filesystem) { ExecutablePath = executablePath }; sut.Run(); runner.Verify(); }
public void GivenPathToExecutable__WhenCallingRun__ShouldStartProcess() { _sut.Run(); AssertProcessWasStartedWithExecutable(_runner, _executablePath); }