public CreateProcess()
            {
                ExpectedResult   = new CreateProcessResult();
                ExpectedResponse = new CreateProcessResponse(JToken.FromObject(1), ExpectedResult);

                MessagingClient.SendMessageAsync <CreateProcessRequest, CreateProcessResponse>(null)
                .ReturnsForAnyArgs(GetCompletedTask(ExpectedResponse));
            }
            public WaitForProcessExit()
            {
                ExpectedResult   = new WaitForProcessExitResult();
                ExpectedResponse = new WaitForProcessExitResponse(JToken.FromObject(1), ExpectedResult);

                MessagingClient.SendMessageAsync <WaitForProcessExitRequest, WaitForProcessExitResponse>(null)
                .ReturnsForAnyArgs(GetCompletedTask(ExpectedResponse));
            }
            public FindProcessById()
            {
                ExpectedResult   = new FindProcessByIdResult();
                ExpectedResponse = new FindProcessByIdResponse(JToken.FromObject(1), ExpectedResult);

                MessagingClient.SendMessageAsync <FindProcessByIdRequest, FindProcessByIdResponse>(null)
                .ReturnsForAnyArgs(GetCompletedTask(ExpectedResponse));
            }
            public void WhenTimeoutOccurs_ReturnsFalse()
            {
                MessagingClient.SendMessageAsync <PingRequest, PingResponse>(null)
                .ReturnsForAnyArgs(async(call) => {
                    await Task.Delay(20);
                    return(ExpectedResponse);
                });

                Assert.False(Client.Ping(TimeSpan.FromMilliseconds(1)));
            }
            public void WhenTimeoutOccurs_ThrowException()
            {
                var @params = new CreateProcessParams
                {
                    executablePath = "foo.exe",
                };

                MessagingClient.SendMessageAsync <CreateProcessRequest, CreateProcessResponse>(null)
                .ReturnsForAnyArgs(async(call) => {
                    await Task.Delay(16 * 1000);
                    return(ExpectedResponse);
                });

                Assert.Throws <TimeoutException>(() => { Client.CreateProcess(@params); });
            }
 public Ping()
 {
     MessagingClient.SendMessageAsync <PingRequest, PingResponse>(null)
     .ReturnsForAnyArgs(GetCompletedTask(ExpectedResponse));
 }