public void TestAirConditioner(string manufacturer, string model) { try { IAirConditioner airConditioner = this.data.GetAirConditioner(manufacturer, model); bool isPassed = airConditioner.Test(); if (isPassed) { airConditioner.Mark = "Passed"; } IReport report = new Report( airConditioner.Manufacturer, airConditioner.Model, airConditioner.Mark); foreach (var rep in data.Reports) { if (rep.Manufacturer == airConditioner.Manufacturer && rep.Model == airConditioner.Model) { throw new DuplicateEntryException("An entry for the given model already exists."); } } data.AddReport(report); writer.WriteLine( $"Air conditioner model {airConditioner.Model}" + $" from {airConditioner.Manufacturer} tested successfully"); } catch (DuplicateEntryException e) { writer.WriteLine(e.Message); } catch (NullReferenceException) { writer.WriteLine("The specified entry does not exist."); } }
public void CompleteSprintReport(int pid) { var tmp = _data.GetPerson(pid).CompleteSprintReport(); _data.AddReport(tmp); }