2 // ProcessTest.cs - NUnit Test Cases for System.Diagnostics.Process
5 // Gert Driesen (drieseng@users.sourceforge.net)
6 // Robert Jordan <robertj@gmx.net>
8 // (C) 2007 Gert Driesen
12 using System.ComponentModel;
13 using System.Diagnostics;
16 using System.Threading;
18 using NUnit.Framework;
20 namespace MonoTests.System.Diagnostics
23 public class ProcessTest
26 public void GetProcessById_MachineName_Null ()
29 Process.GetProcessById (1, (string) null);
31 } catch (ArgumentNullException ex) {
32 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
33 Assert.IsNotNull (ex.Message, "#3");
34 Assert.IsNotNull (ex.ParamName, "#4");
35 Assert.AreEqual ("machineName", ex.ParamName, "#5");
36 Assert.IsNull (ex.InnerException, "#6");
41 public void GetProcesses_MachineName_Null ()
44 Process.GetProcesses ((string) null);
46 } catch (ArgumentNullException ex) {
47 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
48 Assert.IsNotNull (ex.Message, "#3");
49 Assert.IsNotNull (ex.ParamName, "#4");
50 Assert.AreEqual ("machineName", ex.ParamName, "#5");
51 Assert.IsNull (ex.InnerException, "#6");
56 public void PriorityClass_NotStarted ()
58 Process process = new Process ();
60 process.PriorityClass = ProcessPriorityClass.Normal;
62 } catch (InvalidOperationException ex) {
63 // No process is associated with this object
64 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
65 Assert.IsNull (ex.InnerException, "#A3");
66 Assert.IsNotNull (ex.Message, "#A4");
70 Assert.Fail ("#B1:" + process.PriorityClass);
71 } catch (InvalidOperationException ex) {
72 // No process is associated with this object
73 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
74 Assert.IsNull (ex.InnerException, "#B3");
75 Assert.IsNotNull (ex.Message, "#B4");
80 public void PriorityClass_Invalid ()
82 Process process = new Process ();
84 process.PriorityClass = (ProcessPriorityClass) 666;
86 } catch (InvalidEnumArgumentException ex) {
87 Assert.AreEqual (typeof (InvalidEnumArgumentException), ex.GetType (), "#2");
88 Assert.IsNull (ex.InnerException, "#3");
89 Assert.IsNotNull (ex.Message, "#4");
90 Assert.IsTrue (ex.Message.IndexOf ("666") != -1, "#5");
91 Assert.IsTrue (ex.Message.IndexOf (typeof (ProcessPriorityClass).Name) != -1, "#6");
92 Assert.IsNotNull (ex.ParamName, "#7");
93 Assert.AreEqual ("value", ex.ParamName, "#8");
98 public void Start1_FileName_Empty ()
100 Process process = new Process ();
101 process.StartInfo = new ProcessStartInfo (string.Empty);
104 process.StartInfo.UseShellExecute = false;
108 } catch (InvalidOperationException ex) {
109 // Cannot start process because a file name has
111 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
112 Assert.IsNull (ex.InnerException, "#A3");
113 Assert.IsNotNull (ex.Message, "#A4");
117 process.StartInfo.UseShellExecute = true;
121 } catch (InvalidOperationException ex) {
122 // Cannot start process because a file name has
124 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
125 Assert.IsNull (ex.InnerException, "#B3");
126 Assert.IsNotNull (ex.Message, "#B4");
131 public void Start1_FileName_InvalidPathCharacters ()
134 // on unix, all characters are allowed
137 string systemDir = Environment.GetFolderPath (Environment.SpecialFolder.System);
138 string exe = "\"" + Path.Combine (systemDir, "calc.exe") + "\"";
140 Process process = new Process ();
141 process.StartInfo = new ProcessStartInfo (exe);
144 process.StartInfo.UseShellExecute = false;
145 Assert.IsTrue (process.Start ());
149 process.StartInfo.UseShellExecute = true;
150 Assert.IsTrue (process.Start ());
155 public void Start1_FileName_NotFound ()
157 Process process = new Process ();
158 string exe = RunningOnUnix ? exe = "/usr/bin/shouldnoteverexist"
159 : @"c:\shouldnoteverexist.exe";
161 // absolute path, no shell
162 process.StartInfo = new ProcessStartInfo (exe);
163 process.StartInfo.UseShellExecute = false;
167 } catch (Win32Exception ex) {
168 // The system cannot find the file specified
169 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#A2");
170 Assert.AreEqual (-2147467259, ex.ErrorCode, "#A3");
171 Assert.IsNull (ex.InnerException, "#A4");
172 Assert.IsNotNull (ex.Message, "#A5");
173 Assert.AreEqual (2, ex.NativeErrorCode, "#A6");
176 // relative path, no shell
177 process.StartInfo.FileName = "shouldnoteverexist.exe";
178 process.StartInfo.UseShellExecute = false;
182 } catch (Win32Exception ex) {
183 // The system cannot find the file specified
184 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#B2");
185 Assert.AreEqual (-2147467259, ex.ErrorCode, "#B3");
186 Assert.IsNull (ex.InnerException, "#B4");
187 Assert.IsNotNull (ex.Message, "#B5");
188 Assert.AreEqual (2, ex.NativeErrorCode, "#B6");
192 Assert.Ignore ("On Unix and Mac OS X, we try " +
193 "to open any file (using xdg-open, ...)" +
194 " and we do not report an exception " +
197 // absolute path, shell
198 process.StartInfo.FileName = exe;
199 process.StartInfo.UseShellExecute = true;
203 } catch (Win32Exception ex) {
204 // The system cannot find the file specified
205 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#C2");
206 Assert.AreEqual (-2147467259, ex.ErrorCode, "#C3");
207 Assert.IsNull (ex.InnerException, "#C4");
208 Assert.IsNotNull (ex.Message, "#C5");
209 Assert.AreEqual (2, ex.NativeErrorCode, "#C6");
212 // relative path, shell
213 process.StartInfo.FileName = "shouldnoteverexist.exe";
214 process.StartInfo.UseShellExecute = true;
218 } catch (Win32Exception ex) {
219 // The system cannot find the file specified
220 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#D2");
221 Assert.AreEqual (-2147467259, ex.ErrorCode, "#D3");
222 Assert.IsNull (ex.InnerException, "#D4");
223 Assert.IsNotNull (ex.Message, "#D5");
224 Assert.AreEqual (2, ex.NativeErrorCode, "#D6");
229 public void Start1_FileName_Null ()
231 Process process = new Process ();
232 process.StartInfo = new ProcessStartInfo ((string) null);
235 process.StartInfo.UseShellExecute = false;
239 } catch (InvalidOperationException ex) {
240 // Cannot start process because a file name has
242 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
243 Assert.IsNull (ex.InnerException, "#A3");
244 Assert.IsNotNull (ex.Message, "#A4");
248 process.StartInfo.UseShellExecute = true;
252 } catch (InvalidOperationException ex) {
253 // Cannot start process because a file name has
255 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
256 Assert.IsNull (ex.InnerException, "#B3");
257 Assert.IsNotNull (ex.Message, "#B4");
262 public void Start1_FileName_Whitespace ()
264 Process process = new Process ();
265 process.StartInfo = new ProcessStartInfo (" ");
266 process.StartInfo.UseShellExecute = false;
270 } catch (Win32Exception ex) {
271 // The system cannot find the file specified
272 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#2");
273 Assert.AreEqual (-2147467259, ex.ErrorCode, "#3");
274 Assert.IsNull (ex.InnerException, "#4");
275 Assert.IsNotNull (ex.Message, "#5");
276 Assert.AreEqual (2, ex.NativeErrorCode, "#6");
280 [Test] // Start (ProcessStartInfo)
281 public void Start2_FileName_Empty ()
283 ProcessStartInfo startInfo = new ProcessStartInfo (string.Empty);
286 startInfo.UseShellExecute = false;
288 Process.Start (startInfo);
290 } catch (InvalidOperationException ex) {
291 // Cannot start process because a file name has
293 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
294 Assert.IsNull (ex.InnerException, "#A3");
295 Assert.IsNotNull (ex.Message, "#A4");
299 startInfo.UseShellExecute = true;
301 Process.Start (startInfo);
303 } catch (InvalidOperationException ex) {
304 // Cannot start process because a file name has
306 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
307 Assert.IsNull (ex.InnerException, "#B3");
308 Assert.IsNotNull (ex.Message, "#B4");
312 [Test] // Start (ProcessStartInfo)
313 public void Start2_FileName_NotFound ()
315 ProcessStartInfo startInfo = new ProcessStartInfo ();
316 string exe = RunningOnUnix ? exe = "/usr/bin/shouldnoteverexist"
317 : @"c:\shouldnoteverexist.exe";
319 // absolute path, no shell
320 startInfo.FileName = exe;
321 startInfo.UseShellExecute = false;
323 Process.Start (startInfo);
325 } catch (Win32Exception ex) {
326 // The system cannot find the file specified
327 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#A2");
328 Assert.AreEqual (-2147467259, ex.ErrorCode, "#A3");
329 Assert.IsNull (ex.InnerException, "#A4");
330 Assert.IsNotNull (ex.Message, "#A5");
331 Assert.AreEqual (2, ex.NativeErrorCode, "#A6");
334 // relative path, no shell
335 startInfo.FileName = "shouldnoteverexist.exe";
336 startInfo.UseShellExecute = false;
338 Process.Start (startInfo);
340 } catch (Win32Exception ex) {
341 // The system cannot find the file specified
342 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#B2");
343 Assert.AreEqual (-2147467259, ex.ErrorCode, "#B3");
344 Assert.IsNull (ex.InnerException, "#B4");
345 Assert.IsNotNull (ex.Message, "#B5");
346 Assert.AreEqual (2, ex.NativeErrorCode, "#B6");
350 Assert.Ignore ("On Unix and Mac OS X, we try " +
351 "to open any file (using xdg-open, ...)" +
352 " and we do not report an exception " +
355 // absolute path, shell
356 startInfo.FileName = exe;
357 startInfo.UseShellExecute = true;
359 Process.Start (startInfo);
361 } catch (Win32Exception ex) {
362 // The system cannot find the file specified
363 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#C2");
364 Assert.AreEqual (-2147467259, ex.ErrorCode, "#C3");
365 Assert.IsNull (ex.InnerException, "#C4");
366 Assert.IsNotNull (ex.Message, "#C5");
367 Assert.AreEqual (2, ex.NativeErrorCode, "#C6");
370 // relative path, shell
371 startInfo.FileName = "shouldnoteverexist.exe";
372 startInfo.UseShellExecute = true;
374 Process.Start (startInfo);
376 } catch (Win32Exception ex) {
377 // The system cannot find the file specified
378 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#D2");
379 Assert.AreEqual (-2147467259, ex.ErrorCode, "#D3");
380 Assert.IsNull (ex.InnerException, "#D4");
381 Assert.IsNotNull (ex.Message, "#D5");
382 Assert.AreEqual (2, ex.NativeErrorCode, "#D6");
386 [Test] // Start (ProcessStartInfo)
387 public void Start2_FileName_Null ()
389 ProcessStartInfo startInfo = new ProcessStartInfo ((string) null);
392 startInfo.UseShellExecute = false;
394 Process.Start (startInfo);
396 } catch (InvalidOperationException ex) {
397 // Cannot start process because a file name has
399 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#A2");
400 Assert.IsNull (ex.InnerException, "#A3");
401 Assert.IsNotNull (ex.Message, "#A4");
405 startInfo.UseShellExecute = true;
407 Process.Start (startInfo);
409 } catch (InvalidOperationException ex) {
410 // Cannot start process because a file name has
412 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#B2");
413 Assert.IsNull (ex.InnerException, "#B3");
414 Assert.IsNotNull (ex.Message, "#B4");
418 [Test] // Start (ProcessStartInfo)
419 public void Start2_FileName_Whitespace ()
421 ProcessStartInfo startInfo = new ProcessStartInfo (" ");
422 startInfo.UseShellExecute = false;
424 Process.Start (startInfo);
426 } catch (Win32Exception ex) {
427 // The system cannot find the file specified
428 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#2");
429 Assert.AreEqual (-2147467259, ex.ErrorCode, "#3");
430 Assert.IsNull (ex.InnerException, "#4");
431 Assert.IsNotNull (ex.Message, "#5");
432 Assert.AreEqual (2, ex.NativeErrorCode, "#6");
436 [Test] // Start (ProcessStartInfo)
437 public void Start2_StartInfo_Null ()
440 Process.Start ((ProcessStartInfo) null);
442 } catch (ArgumentNullException ex) {
443 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
444 Assert.IsNull (ex.InnerException, "#3");
445 Assert.IsNotNull (ex.Message, "#4");
446 Assert.IsNotNull (ex.ParamName, "#5");
447 Assert.AreEqual ("startInfo", ex.ParamName, "#6");
451 [Test] // Start (string)
452 public void Start3_FileName_Empty ()
455 Process.Start (string.Empty);
457 } catch (InvalidOperationException ex) {
458 // Cannot start process because a file name has
460 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
461 Assert.IsNull (ex.InnerException, "#3");
462 Assert.IsNotNull (ex.Message, "#4");
466 [Test] // Start (string)
467 public void Start3_FileName_NotFound ()
470 Assert.Ignore ("On Unix and Mac OS X, we try " +
471 "to open any file (using xdg-open, ...)" +
472 " and we do not report an exception " +
475 string exe = @"c:\shouldnoteverexist.exe";
477 // absolute path, no shell
481 } catch (Win32Exception ex) {
482 // The system cannot find the file specified
483 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#A2");
484 Assert.AreEqual (-2147467259, ex.ErrorCode, "#A3");
485 Assert.IsNull (ex.InnerException, "#A4");
486 Assert.IsNotNull (ex.Message, "#A5");
487 Assert.AreEqual (2, ex.NativeErrorCode, "#A6");
490 // relative path, no shell
492 Process.Start ("shouldnoteverexist.exe");
494 } catch (Win32Exception ex) {
495 // The system cannot find the file specified
496 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#B2");
497 Assert.AreEqual (-2147467259, ex.ErrorCode, "#B3");
498 Assert.IsNull (ex.InnerException, "#B4");
499 Assert.IsNotNull (ex.Message, "#B5");
500 Assert.AreEqual (2, ex.NativeErrorCode, "#B6");
504 [Test] // Start (string)
505 public void Start3_FileName_Null ()
508 Process.Start ((string) null);
510 } catch (InvalidOperationException ex) {
511 // Cannot start process because a file name has
513 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
514 Assert.IsNull (ex.InnerException, "#3");
515 Assert.IsNotNull (ex.Message, "#4");
519 [Test] // Start (string, string)
520 public void Start4_Arguments_Null ()
523 Assert.Ignore ("On Unix and Mac OS X, we try " +
524 "to open any file (using xdg-open, ...)" +
525 " and we do not report an exception " +
528 string exe = @"c:\shouldnoteverexist.exe";
531 Process.Start ("whatever.exe", (string) null);
533 } catch (Win32Exception ex) {
534 // The system cannot find the file specified
535 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#B2");
536 Assert.AreEqual (-2147467259, ex.ErrorCode, "#B3");
537 Assert.IsNull (ex.InnerException, "#B4");
538 Assert.IsNotNull (ex.Message, "#B5");
539 Assert.AreEqual (2, ex.NativeErrorCode, "#B6");
543 [Test] // Start (string, string)
544 public void Start4_FileName_Empty ()
547 Process.Start (string.Empty, string.Empty);
549 } catch (InvalidOperationException ex) {
550 // Cannot start process because a file name has
552 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
553 Assert.IsNull (ex.InnerException, "#3");
554 Assert.IsNotNull (ex.Message, "#4");
558 [Test] // Start (string, string)
559 public void Start4_FileName_NotFound ()
562 Assert.Ignore ("On Unix and Mac OS X, we try " +
563 "to open any file (using xdg-open, ...)" +
564 " and we do not report an exception " +
567 string exe = @"c:\shouldnoteverexist.exe";
569 // absolute path, no shell
571 Process.Start (exe, string.Empty);
573 } catch (Win32Exception ex) {
574 // The system cannot find the file specified
575 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#A2");
576 Assert.AreEqual (-2147467259, ex.ErrorCode, "#A3");
577 Assert.IsNull (ex.InnerException, "#A4");
578 Assert.IsNotNull (ex.Message, "#A5");
579 Assert.AreEqual (2, ex.NativeErrorCode, "#A6");
582 // relative path, no shell
584 Process.Start ("shouldnoteverexist.exe", string.Empty);
586 } catch (Win32Exception ex) {
587 // The system cannot find the file specified
588 Assert.AreEqual (typeof (Win32Exception), ex.GetType (), "#B2");
589 Assert.AreEqual (-2147467259, ex.ErrorCode, "#B3");
590 Assert.IsNull (ex.InnerException, "#B4");
591 Assert.IsNotNull (ex.Message, "#B5");
592 Assert.AreEqual (2, ex.NativeErrorCode, "#B6");
598 public void Start_UseShellExecuteWithEmptyUserName ()
601 Assert.Ignore ("On Unix and Mac OS X, we try " +
602 "to open any file (using xdg-open, ...)" +
603 " and we do not report an exception " +
606 string exe = @"c:\shouldnoteverexist.exe";
609 Process p = new Process ();
610 p.StartInfo.FileName = exe;
611 p.StartInfo.UseShellExecute = true;
612 p.StartInfo.UserName = "";
615 } catch (InvalidOperationException) {
617 } catch (Win32Exception) {
621 Process p = new Process ();
622 p.StartInfo.FileName = exe;
623 p.StartInfo.UseShellExecute = true;
624 p.StartInfo.UserName = null;
627 } catch (InvalidOperationException) {
629 } catch (Win32Exception) {
634 [Test] // Start (string, string)
635 public void Start4_FileName_Null ()
638 Process.Start ((string) null, string.Empty);
640 } catch (InvalidOperationException ex) {
641 // Cannot start process because a file name has
643 Assert.AreEqual (typeof (InvalidOperationException), ex.GetType (), "#2");
644 Assert.IsNull (ex.InnerException, "#3");
645 Assert.IsNotNull (ex.Message, "#4");
650 public void StartInfo ()
652 ProcessStartInfo startInfo = new ProcessStartInfo ();
654 Process p = new Process ();
655 Assert.IsNotNull (p.StartInfo, "#A1");
656 p.StartInfo = startInfo;
657 Assert.AreSame (startInfo, p.StartInfo, "#A2");
661 public void StartInfo_Null ()
663 Process p = new Process ();
667 } catch (ArgumentNullException ex) {
668 Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
669 Assert.IsNull (ex.InnerException, "#3");
670 Assert.IsNotNull (ex.Message, "#4");
671 Assert.IsNotNull (ex.ParamName, "#5");
672 Assert.AreEqual ("value", ex.ParamName, "#6");
677 [NUnit.Framework.Category ("NotDotNet")]
678 [NUnit.Framework.Category ("NotMobile")]
679 public void TestRedirectedOutputIsAsync ()
681 // Test requires cygwin, so we just bail out for now.
682 if (Path.DirectorySeparatorChar == '\\')
685 Process p = new Process ();
686 p.StartInfo = new ProcessStartInfo ("/bin/sh", "-c \"sleep 2; echo hello\"");
687 p.StartInfo.RedirectStandardOutput = true;
688 p.StartInfo.UseShellExecute = false;
691 Stream stdout = p.StandardOutput.BaseStream;
693 byte [] buffer = new byte [200];
695 // start async Read operation
696 DateTime start = DateTime.Now;
697 IAsyncResult ar = stdout.BeginRead (buffer, 0, buffer.Length,
698 new AsyncCallback (Read), stdout);
700 Assert.IsTrue ((DateTime.Now - start).TotalMilliseconds < 1000, "#01 BeginRead was not async");
702 Assert.AreEqual (0, p.ExitCode, "#02 script failure");
705 ar.AsyncWaitHandle.WaitOne (2000, false);
706 if (bytesRead < "hello".Length)
707 Assert.Fail ("#03 got {0} bytes", bytesRead);
708 Assert.AreEqual ("hello", Encoding.Default.GetString (buffer, 0, 5), "#04");
712 void Read (IAsyncResult ar)
714 Stream stm = (Stream) ar.AsyncState;
715 bytesRead = stm.EndRead (ar);
718 static bool RunningOnUnix {
720 int p = (int)Environment.OSVersion.Platform;
721 return ((p == 128) || (p == 4) || (p == 6));
728 // Not technically a 2.0 only test, but I use lambdas, so I need gmcs
731 // This was for bug #459450
732 public void TestEventRaising ()
734 EventWaitHandle errorClosed = new ManualResetEvent(false);
735 EventWaitHandle outClosed = new ManualResetEvent(false);
736 EventWaitHandle exited = new ManualResetEvent(false);
738 Process p = new Process();
740 p.StartInfo = GetCrossPlatformStartInfo ();
741 p.StartInfo.UseShellExecute = false;
742 p.StartInfo.RedirectStandardOutput = true;
743 p.StartInfo.RedirectStandardError = true;
744 p.StartInfo.RedirectStandardInput = false;
745 p.OutputDataReceived += (object sender, DataReceivedEventArgs e) => {
746 if (e.Data == null) {
751 p.ErrorDataReceived += (object sender, DataReceivedEventArgs e) => {
752 if (e.Data == null) {
757 p.Exited += (object sender, EventArgs e) => {
761 p.EnableRaisingEvents = true;
765 p.BeginErrorReadLine();
766 p.BeginOutputReadLine();
768 Console.WriteLine("started, waiting for handles");
769 bool r = WaitHandle.WaitAll(new WaitHandle[] { errorClosed, outClosed, exited }, 10000, false);
771 Assert.AreEqual (true, r, "Null Argument Events Raised");
774 private ProcessStartInfo GetCrossPlatformStartInfo ()
776 return RunningOnUnix ? new ProcessStartInfo ("/bin/ls", "/") : new ProcessStartInfo ("help", "");
780 public void ProcessName_NotStarted ()
782 Process p = new Process ();
785 String.IsNullOrEmpty (p.ProcessName);
786 } catch (Exception ex) {
790 Assert.IsNotNull (e, "ProcessName should raise if process was not started");
792 //msg should be "No process is associated with this object"
793 Assert.AreEqual (e.GetType (), typeof (InvalidOperationException),
794 "exception should be IOE, I got: " + e.GetType ().Name);
796 Assert.IsNull (e.InnerException, "IOE inner exception should be null");
800 public void ProcessName_AfterExit ()
802 Process p = new Process ();
803 p.StartInfo = GetCrossPlatformStartInfo ();
804 p.StartInfo.UseShellExecute = false;
805 p.StartInfo.RedirectStandardOutput = true;
806 p.StartInfo.RedirectStandardError = true;
808 p.BeginErrorReadLine();
809 p.BeginOutputReadLine();
811 String.IsNullOrEmpty (p.ExitCode + "");
815 String.IsNullOrEmpty (p.ProcessName);
816 } catch (Exception ex) {
820 Assert.IsNotNull (e, "ProcessName should raise if process was finished");
822 //msg should be "Process has exited, so the requested information is not available"
823 Assert.AreEqual (e.GetType (), typeof (InvalidOperationException),
824 "exception should be IOE, I got: " + e.GetType ().Name);
826 Assert.IsNull (e.InnerException, "IOE inner exception should be null");