+2007-01-02 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * System_test.dll.sources: Added ProcessTest.cs.
+
2006-12-22 Rolf Bjarne Kvinge <RKvinge@novell.com>
* System_test.dll.sources: added DefaultBindingPropertyAttributeTest.cs
+2007-01-02 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * Process.cs: Allow GetProcesses and GetProcessById overloads with
+ machine name to work for local machine.
+
2006-12-29 Robert Jordan <robertj@gmx.net>
* TraceImpl.cs (Assert): Include line numbers in the stack trace
return (new Process (proc, processId));
}
- [MonoTODO]
+ [MonoTODO ("There is no support for retrieving process information from a remote machine")]
public static Process GetProcessById(int processId, string machineName) {
- throw new NotImplementedException();
+ if (machineName == null)
+ throw new ArgumentNullException ("machineName");
+
+ if (!IsLocalMachine (machineName))
+ throw new NotImplementedException ();
+
+ return GetProcessById (processId);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
[MonoTODO ("There is no support for retrieving process information from a remote machine")]
public static Process[] GetProcesses(string machineName) {
- throw new NotImplementedException();
+ if (machineName == null)
+ throw new ArgumentNullException ("machineName");
+
+ if (!IsLocalMachine (machineName))
+ throw new NotImplementedException ();
+
+ return GetProcesses ();
}
public static Process[] GetProcessesByName(string processName)
return(false);
}
+ private static bool IsLocalMachine (string machineName)
+ {
+ if (machineName == "." || machineName.Length == 0)
+ return true;
+
+ return (string.Compare (machineName, Environment.MachineName, true) == 0);
+ }
#if NET_2_0
public event DataReceivedEventHandler OutputDataReceived;
System.Diagnostics/EventSourceCreationDataTest.cs
System.Diagnostics/PerformanceCounterPermissionAttributeTest.cs
System.Diagnostics/PerformanceCounterPermissionTest.cs
+System.Diagnostics/ProcessTest.cs
System.IO/FileSystemWatcherTest.cs
System.IO.Compression/DeflateStreamTest.cs
System.IO.Compression/GzipStreamTest.cs
+2007-01-02 Gert Driesen <drieseng@users.sourceforge.net>
+
+ * ProcessTest.cs: Added null check tests.
+
2006-08-27 Gert Driesen <drieseng@users.sourceforge.net>
* EventLogTest.cs: Added tests for log name validation in
--- /dev/null
+//
+// ProcessTest.cs - NUnit Test Cases for System.Diagnostics.Process
+//
+// Authors:
+// Gert Driesen (drieseng@users.sourceforge.net)
+//
+// (C) 2007 Gert Driesen
+//
+
+using System;
+using System.Diagnostics;
+
+using NUnit.Framework;
+
+namespace MonoTests.System.Diagnostics
+{
+ [TestFixture]
+ public class ProcessTest
+ {
+ [Test]
+ public void GetProcessById_MachineName_Null ()
+ {
+ try {
+ Process.GetProcessById (1, (string) null);
+ Assert.Fail ("#1");
+ } catch (ArgumentNullException ex) {
+ Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+ Assert.IsNotNull (ex.Message, "#3");
+ Assert.IsNotNull (ex.ParamName, "#4");
+ Assert.AreEqual ("machineName", ex.ParamName, "#5");
+ Assert.IsNull (ex.InnerException, "#6");
+ }
+ }
+
+ [Test]
+ public void GetProcesses_MachineName_Null ()
+ {
+ try {
+ Process.GetProcesses ((string) null);
+ Assert.Fail ("#1");
+ } catch (ArgumentNullException ex) {
+ Assert.AreEqual (typeof (ArgumentNullException), ex.GetType (), "#2");
+ Assert.IsNotNull (ex.Message, "#3");
+ Assert.IsNotNull (ex.ParamName, "#4");
+ Assert.AreEqual ("machineName", ex.ParamName, "#5");
+ Assert.IsNull (ex.InnerException, "#6");
+ }
+ }
+ }
+}