public IActionResult Repair() { var service = new TieFighterRepairService(_tieFighterRepository); service.RepairTieFighters(); return(Ok()); }
public void TestRepairTieFighters() { var repo = new Mock <ITieFighterRepository>(); repo.Setup(m => m.GetDamagedTieFighters()).Returns(() => { return(_data.Where(d => d.IsDamaged).ToList()); }); Assert.DoesNotThrow(() => { var repairer = new TieFighterRepairService(repo.Object); repairer.RepairTieFighters(); }); // There should be no damaged tie fighters after they have been repaired. Assert.IsEmpty(_data.Where(d => d.IsDamaged).ToList()); }