public void StartTest()
        {
            var process = new MockThreadedBeginStopWithSleepingThreadProcess();
            var target = new ThreadedProcess_Accessor(new PrivateObject(process));

            target.Start();

            Assert.AreEqual(ProcessExecutionState.Running, process.ExecutionState);

            target.Stop();

            Assert.AreEqual(ProcessExecutionState.Terminated, process.ExecutionState);
            Assert.IsTrue(target.WorkingThread.ThreadState == ThreadState.Stopped);
        }
        public void SelfSuspendTest()
        {
            // time to suspend, ms.
            const int suspendTimeout = 5000;
            MockThreadedSuspendProcess process = new MockThreadedSuspendProcess(suspendTimeout);
            ThreadedProcess_Accessor target = new ThreadedProcess_Accessor(new PrivateObject(process ));

            target.Start();
            // give it some time before calling stop, or if it completes it will set its event (not now :))
            target.CompletedEvent.WaitOne((int)(suspendTimeout*2));

            target.Stop();

            Assert.IsTrue(process.StopWatch.ElapsedMilliseconds >= suspendTimeout);
            Assert.IsTrue(!process.ResumedBeforeTimeout);
        }