public void ProcessIoCanBeNull() { var io = new TestProcessIO(); io.Output = null; io.Error = null; Container.Run(Spec, io); var proc = ConstrainedProcessRunner.Captured(x => x.Run(null)).Arg <ProcessRunSpec>(); Assert.Equal(null, proc.OutputCallback); Assert.Equal(null, proc.ErrorCallback); }
public void ProcessIoIsRedirected() { var io = new TestProcessIO(); var remoteProcess = Substitute.For <IProcess>(); ConstrainedProcessRunner.Run(Arg.Any <ProcessRunSpec>()).Returns(remoteProcess) .AndDoes(call => { var runSpec = call.Arg <ProcessRunSpec>(); runSpec.OutputCallback("This is STDOUT"); runSpec.ErrorCallback("This is STDERR"); }); Container.Run(Spec, io); Assert.Equal("This is STDOUT", io.Output.ToString()); Assert.Equal("This is STDERR", io.Error.ToString()); }
public void ProcessIoIsRedirected() { var io = new TestProcessIO(); var localProcess = Substitute.For<IProcess>(); ProcessRunner.Run(Arg.Any<ProcessRunSpec>()).Returns(localProcess) .AndDoes(call => { var runSpec = call.Arg<ProcessRunSpec>(); runSpec.OutputCallback("This is STDOUT"); runSpec.ErrorCallback("This is STDERR"); }); Container.Run(Spec, io); Assert.Equal("This is STDOUT", io.Output.ToString()); Assert.Equal("This is STDERR", io.Error.ToString()); }
public void ProcessIoCanBeNull() { var io = new TestProcessIO(); io.Output = null; io.Error = null; Container.Run(Spec, io); var proc = ConstrainedProcessRunner.Captured(x => x.Run(null)).Arg<ProcessRunSpec>(); Assert.Equal(null, proc.OutputCallback); Assert.Equal(null, proc.ErrorCallback); }