public void CmdRunner_ExitCode_InBetween() { bool finalized = false; ManualResetEvent mre = new ManualResetEvent(false); CmdRunner runner = new CmdRunner(runnerFile, runnerArgs + "-delay:2", new ListStringOutputHandler()); runner.Run(false); int ret = runner.GetReturnCode(); Assert.AreEqual(CmdRunner.UNDEFINED_EXITCODE, ret, "While waiting, retCode not as expected"); Assert.IsFalse(finalized, "Finalized should NOT be true here"); runner.processFinished += delegate(object sender, EventArgs e) { mre.Set(); finalized = true; }; mre.WaitOne(2500, false); ret = runner.GetReturnCode(); Assert.That(ret, Is.Not.EqualTo(CmdRunner.UNDEFINED_EXITCODE).After(100), "After the wait, retcode not as expected."); Assert.IsTrue(finalized, "Finalized should be true here"); }
public void CmdRunner_ExitCode_Successful() { CmdRunner runner = new CmdRunner(runnerFile, runnerArgs, new ListStringOutputHandler()); runner.Run(true); int ret = runner.GetReturnCode(); Assert.AreEqual(1, ret, "return value for the exit code is not as expected"); }