public void TestCpuWorkerSignalStop() { CpuWorker worker = CreateCpuWorker(); worker.Start(); worker.SignalStop(); Assert.AreEqual(worker.State, ExecutionState.Stopped); worker.SignalStop(); Assert.AreEqual(worker.State, ExecutionState.Stopped); worker.Start(); Assert.AreNotEqual(worker.State, ExecutionState.Stopped); worker.SignalPause(); worker.SignalStop(); Assert.AreEqual(worker.State, ExecutionState.Stopped); worker.Start(); worker.SignalPause(); worker.SignalResume(); worker.SignalStop(); Assert.AreEqual(worker.State, ExecutionState.Stopped); }
public void TestCpuWorkerSignalPause() { CpuWorker worker = CreateCpuWorker(); worker.Start(); worker.SignalPause(); Assert.AreEqual(worker.State, ExecutionState.Paused); worker.SignalPause(); Assert.AreEqual(worker.State, ExecutionState.Paused); worker.SignalStop(); Assert.AreNotEqual(worker.State, ExecutionState.Paused); Assert.Throws <InvalidOperationException>(() => worker.SignalPause()); Assert.AreNotEqual(worker.State, ExecutionState.Paused); }