Library/Library.Test/TestScriptRunner.cs
C# | Copy Code |
---|---|
using (ScriptRunner runner = new ScriptRunner(ScriptEngine.Language.Cmd, "@ECHO From CMD.exe")) { ManualResetEvent mre = new ManualResetEvent(false); ProcessExitedEventHandler h = delegate(object o, ProcessExitedEventArgs e) { mre.Set(); }; runner.ProcessExited += h; runner.ProcessExited -= h; Assert.AreEqual(0, runner.Run()); Assert.IsFalse(mre.WaitOne(250, false)); } |
VB.NET | Copy Code |
---|---|
Using runner As New ScriptRunner(ScriptEngine.Language.Cmd, "@ECHO From CMD.exe") Dim mre As New ManualResetEvent(False) Dim h As ProcessExitedEventHandler = Function(o As Object, e As ProcessExitedEventArgs) Do mre.[Set]() End Function runner.ProcessExited += h runner.ProcessExited -= h Assert.AreEqual(0, runner.Run()) Assert.IsFalse(mre.WaitOne(250, False)) End Using |
Target Platforms: Windows XP, Windows Server 2003, Windows Vista, Windows Server 2008, Windows 7
Reference
ScriptRunner ClassScriptRunner Members
Overload List