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