public void TestStartPauseResumeCancelJob()
        {
            _service.Start(GetInputString());
            Assert.AreEqual(MicroWaveStatus.Running, _service.GetStatus());

            _service.Pause();
            Assert.AreEqual(MicroWaveStatus.DoorOpen, _service.GetStatus());

            _service.Resume();
            Assert.AreEqual(MicroWaveStatus.Running, _service.GetStatus());

            _service.Cancel();
            Assert.AreEqual(MicroWaveStatus.JobLess, _service.GetStatus());
        }
Пример #2
0
        private void PauseStart()
        {
            switch (_service.GetStatus())
            {
            case MicroWaveStatus.Ready:
            case MicroWaveStatus.JobLess:
                btnStart.Text = "PAUSE";
                WrapVoid(() => _service.Start(txtInputString.Text));
                break;

            case MicroWaveStatus.DoorOpen:
                btnStart.Text = "PAUSE";
                WrapVoid(() => _service.Resume());
                break;

            case MicroWaveStatus.Running:
                WrapVoid(() => _service.Pause());
                btnStart.Text = "START";
                break;

            default: break;
            }
        }