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 TestJobTemplate() { JobTemplate newTemplate = GetNewTemplate(); _service.SetJobTemplate(newTemplate); var expected = _service.SerializeCurrentJobTemplateToJson(); var options = new JsonSerializerOptions { WriteIndented = true }; var actual = JsonSerializer.Serialize(_service.GetMicroWave().CurrentJob.Template, options); Assert.AreEqual(expected, actual); }