Пример #1
0
        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);
        }
Пример #2
0
        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();
        }