예제 #1
0
            public void WhenProcessExits_SetsExitCode()
            {
                HostClient.WaitForProcessExit(null)
                .ReturnsForAnyArgs(new WaitForProcessExitResult {
                    exited = true, exitCode = 100
                });

                Process.WaitForExit();

                Assert.Equal(100, Process.ExitCode);
            }
예제 #2
0
            public void WhenProcessExits_ReturnsTrue()
            {
                HostClient.WaitForProcessExit(null)
                .ReturnsForAnyArgs(new WaitForProcessExitResult {
                    exited = true
                });

                var success = Process.WaitForExit(1);

                Assert.True(success);
            }
예제 #3
0
            public void DefaultTimeoutIsInfinite()
            {
                HostClient.WaitForProcessExit(null).ReturnsForAnyArgs(new WaitForProcessExitResult());
                Process.WaitForExit();

                HostClient.Received(1).WaitForProcessExit(
                    Arg.Is <WaitForProcessExitParams>(actual =>
                                                      actual.key == ProcessKey && actual.timeout == Timeout.Infinite
                                                      )
                    );
            }
예제 #4
0
            public void WhenTimeoutOccurs_ReturnsFalse()
            {
                HostClient.WaitForProcessExit(null)
                .ReturnsForAnyArgs(new WaitForProcessExitResult {
                    exited = false
                });

                var success = Process.WaitForExit(0);

                Assert.False(success);
            }
예제 #5
0
            public void ForwardsToHostClient()
            {
                HostClient.WaitForProcessExit(null).ReturnsForAnyArgs(new WaitForProcessExitResult());
                Process.WaitForExit(100);

                HostClient.Received(1).WaitForProcessExit(
                    Arg.Is <WaitForProcessExitParams>(actual =>
                                                      actual.key == ProcessKey && actual.timeout == 100
                                                      )
                    );
            }