public Stop ( bool force ) : void | ||
force | bool | A value indicating whether to force the process to exit immediately. |
Результат | void |
public void ApplicationProcessStopForce() { string path = ApplicationUtils.CreateValidExampleApplication(); ManualResetEvent handle = new ManualResetEvent(false); try { using (ApplicationProcess process = new ApplicationProcess(Logger, path, Path.GetFullPath("Collar.exe"))) { process.Exited += (object sender, EventArgs e) => { Assert.Fail(); handle.Set(); }; process.KillTimeout += (object sender, EventArgs e) => { Assert.Fail(); handle.Set(); }; Assert.IsTrue(process.Start()); process.Stop(true); WaitHandle.WaitAll(new WaitHandle[] { handle }, 11000); } } finally { handle.Close(); } }