public void Should_call_remote_console() { StartConsoleHost(); var testHandler = new CallbackHandler(); var svcProxy = new ConsoleRunnerClient(new InstanceContext(testHandler)); var startMsg = new StartExecutionMessage("ping.exe"); startMsg.Arguments = "localhost"; svcProxy.Run(startMsg); // wait for completion while (!testHandler.IsComplete) { Thread.Sleep(100); } }
public void Should_send_exit_code() { IConsoleListener listener = MockRepository.GenerateMock <IConsoleListener>(); listener.Stub(o => o.ExecutionProgress(null)).IgnoreArguments().WhenCalled(a => GetExecutionProgressMessage(a.Arguments[0])); listener.Stub(o => o.ExecutionComplete(null)).IgnoreArguments().WhenCalled(a => GetExecutionFinishedMessage(a.Arguments[0])); StartExecutionMessage executionMessage = new StartExecutionMessage("ping.exe"); executionMessage.Arguments = "localhost"; ConsoleRunner runner = new ConsoleRunner(listener); runner.Run(executionMessage); WaitForCompletionMessage(); Assert.AreEqual(0, _finishMsg.ExitCode, "The exit code was an error, i.e. non-zero"); Assert.IsFalse(_finishMsg.IsError, "The response was an error"); }
public void Should_send_output_async() { IConsoleListener listener = MockRepository.GenerateMock <IConsoleListener>(); listener.Stub(o => o.ExecutionProgress(null)).IgnoreArguments().WhenCalled(a => GetExecutionProgressMessage(a.Arguments[0])); listener.Stub(o => o.ExecutionComplete(null)).IgnoreArguments().WhenCalled(a => GetExecutionFinishedMessage(a.Arguments[0])); StartExecutionMessage executionMessage = new StartExecutionMessage("ping.exe"); executionMessage.Arguments = "localhost"; ConsoleRunner runner = new ConsoleRunner(listener); runner.Run(executionMessage); WaitForCompletionMessage(); Assert.That(_output.Contains("Pinging")); Assert.That(_output.Contains("Approximate round trip times in milli-seconds")); }
static void Main(string[] args) { var cmdLineHandler = new CommandLineHandler(args); CommandSwitches switches = cmdLineHandler.GetSwitches(); StartExecutionMessage startMsg = cmdLineHandler.CreateStartExecutionMessageFromCommandLine(); EndpointAddress endpointAddress = new EndpointAddress(switches.EndpointAddress); WSDualHttpBinding serviceBinding = new WSDualHttpBinding(); if (startMsg.Timeout > 0) { serviceBinding.ReceiveTimeout = TimeSpan.FromSeconds(startMsg.Timeout); } var callbackHandler = new ConsoleCallbackHandler(); var svcProxy = new ConsoleRunnerClient(new InstanceContext(callbackHandler), serviceBinding, endpointAddress); svcProxy.Run(startMsg); while (!callbackHandler.IsComplete) { Thread.Sleep(100); } }