[process] Improve error message for inaccessible process (#4354)
[mono.git] / mcs / class / System / Test / System.Diagnostics / ProcessTest.cs
index 20a93a732b6f1d1c3dc00368a5e0e0bc846db7c9..dcf83695f06517fa3d91dd10a1519d2bf7f5cf91 100644 (file)
@@ -1113,5 +1113,22 @@ namespace MonoTests.System.Diagnostics
                        }
                }
 #endif // MONO_FEATURE_PROCESS_START
+
+               [Test]
+               public void GetProcessesByName()
+               {
+                       // This should return Process[0] or a Process[] with all the "foo" programs running
+                       Process.GetProcessesByName ("foo");
+               }
+
+               [Test]
+               [ExpectedException(typeof(InvalidOperationException))]
+               public void HigherPrivilegeProcessName ()
+               {
+                       if (!RunningOnUnix)
+                               Assert.Ignore ("accessing pid 1, only available on unix");
+
+                       string v = Process.GetProcessById (1).ProcessName;
+               }
        }
 }