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 TestCpuWorkerSignalResume() { CpuWorker worker = CreateCpuWorker(); worker.Start(); worker.SignalPause(); worker.SignalResume(); Assert.AreEqual(worker.State, ExecutionState.Running); worker.SignalResume(); Assert.AreEqual(worker.State, ExecutionState.Running); worker.SignalStop(); Assert.Throws <InvalidOperationException>(() => worker.SignalResume()); worker.SignalStop(); }