Example #1
0
 /// <summary>
 /// Generic Wrap to handle exceptions in a call
 /// </summary>
 /// <param name="func">Any method returns void</param>
 private void WrapVoid(Action func)
 {
     try
     {
         func();
     }
     catch (Exception ex)
     {
         SystemSounds.Hand.Play();
         txtOutput.Text = ex.Message;
         btnStart.Text  = "START";
         var job = Wrap(() => _service.GetMicroWave().CurrentJob);
         if (job != null)
         {
             txtPotency.Value = (Decimal)job.Potency;
         }
     }
 }
        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);
        }