[process] Improve error message for inaccessible process (#4354)
[mono.git] / mcs / class / System / Test / System.Diagnostics / ProcessTest.cs
index ac07fdc8bab5cfb132beb28b8ede2f3a76dd832b..dcf83695f06517fa3d91dd10a1519d2bf7f5cf91 100644 (file)
@@ -1120,5 +1120,15 @@ namespace MonoTests.System.Diagnostics
                        // 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;
+               }
        }
 }