Example #1
0
        private void btnStartTemplate_Click(object sender, System.EventArgs e)
        {
            if (_service.GetStatus() == MicroWaveStatus.Ready || _service.GetStatus() == MicroWaveStatus.JobLess)
            {
                var template = (JobTemplate)lbxTemplate.SelectedItem;

                if (template == null)
                {
                    txtOutput.Text = "No template selected";
                }
                else
                {
                    _service.SetJobTemplate(template);

                    txtPotency.Value = (Decimal)template.Potency;
                    SetWatch(template.TimeLeft);

                    txtInputString.Text = _service.SerializeCurrentJobTemplateToJson();
                    PauseStart();
                }
            }
            else
            {
                txtOutput.Text = "Microwave is already running a job";
            }
        }
        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());
        }