public void TestKill() { Environment.CurrentDirectory = Path.GetDirectoryName(FileUtils.FindFullPath("cmd.exe")); using (AssemblyRunner runner = new AssemblyRunner(Exe)) { ManualResetEvent gotExit = new ManualResetEvent(false); runner.ProcessExited += delegate(Object o, ProcessExitedEventArgs e) { gotExit.Set(); }; Assert.IsFalse(runner.IsRunning); runner.Kill(); // always safe to call runner.Start("-wait"); Assert.IsTrue(runner.IsRunning); try //make sure we can't start twice. { runner.Start(); Assert.Fail(); } catch (InvalidOperationException) { } Assert.IsFalse(runner.WaitForExit(TimeSpan.FromSeconds(1), false)); runner.Kill(); Assert.IsFalse(runner.IsRunning); Assert.IsTrue(gotExit.WaitOne(30000, false)); } }
public void TestStandardInputFail() { using (IRunner runner = new AssemblyRunner(Exe)) { runner.Start("-wait"); runner.StandardInput.WriteLine(); } }
public void TestUnhandledExceptionWaitForExit() { using (IRunner runner = new AssemblyRunner(Exe)) { runner.Start("-throw", "System.ArgumentOutOfRangeException"); runner.WaitForExit(); Assert.Fail(); } }