public void TestReturnsResult() { var jobObjectHandle = IntPtr.Zero; try { jobObjectHandle = PInvokeUtils.Try(() => JobObjectAPI.CreateJobObject(IntPtr.Zero, null), result => result != IntPtr.Zero); Assert.AreNotEqual(jobObjectHandle, IntPtr.Zero); } finally { if (jobObjectHandle != IntPtr.Zero) { JobObjectAPI.CloseHandle(jobObjectHandle); } } }
/// <exception cref="Win32Exception"> /// Thrown if the operating system was unable to create a new Job Object. /// </exception> public JobObject() { _jobObjectHandle = PInvokeUtils.Try(() => JobObjectAPI.CreateJobObject(IntPtr.Zero, null)); }