Exemplo n.º 1
0
                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);
                }
Exemplo n.º 2
0
                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());
                }
Exemplo n.º 3
0
                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());
                }
Exemplo n.º 4
0
                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);
                }