public void Should_Use_Environments_Working_Directory() { // Given var fixture = new ProcessFixture(); // When fixture.StartNewProcess("hello.exe"); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>( info => info.WorkingDirectory.FullPath == "/Working")); }
public void Should_Throw_If_No_Process_Was_Returned_From_Process_Runner() { // Given var fixture = new ProcessFixture(); fixture.ProcessRunner.Start(Arg.Any <FilePath>(), Arg.Any <ProcessSettings>()) .Returns((IProcess)null); // When var result = Record.Exception(() => fixture.StartNewProcess("hello.exe")); // Then Assert.IsType <CakeException>(result); Assert.Equal("Could not start process.", result?.Message); }
public void Should_Use_Environments_Working_Directory_If_Not_Working_Directory_Is_Set() { // Given var fixture = new ProcessFixture(); const string fileName = "hello.exe"; var settings = new ProcessSettings(); // When fixture.StartNewProcess(fileName, settings); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>(info => info.WorkingDirectory.FullPath == "/Working")); }
public void Should_Return_Process_Started_By_ProcessRunner() { // Given var fixture = new ProcessFixture(); const string fileName = "hello.exe"; var expected = fixture.Process; fixture.ProcessRunner.Start(Arg.Any <FilePath>(), Arg.Any <ProcessSettings>()).Returns(p => expected); // When var result = fixture.StartNewProcess(fileName); // Then Assert.Same(expected, result); }
public void Should_Return_Process_Started_By_ProcessRunner() { // Given var fixture = new ProcessFixture(); const string fileName = "hello.exe"; var settings = new ProcessSettings(); var expected = fixture.Process; fixture.ProcessRunner.Start(Arg.Any <FilePath>(), Arg.Any <ProcessSettings>()).Returns(p => expected); // When fixture.StartNewProcess(fileName, settings); // Then Assert.IsAssignableFrom <IProcess>(expected); }
public void Should_Make_Working_Directory_Absolute_If_Set() { // Given var fixture = new ProcessFixture(); const string fileName = "hello.exe"; var settings = new ProcessSettings(); settings.WorkingDirectory = "OtherWorking"; // When fixture.StartNewProcess(fileName, settings); // Then fixture.ProcessRunner.Received(1).Start( Arg.Any <FilePath>(), Arg.Is <ProcessSettings>(info => info.WorkingDirectory.FullPath == "/Working/OtherWorking")); }