public void T08_ControlTowerGives3EmptyRunways1NullIf3PresentAndRequested() { // Given ControlTower tower = new ControlTower(new Runway[] { new Runway("r1"), new Runway("r2"), new Runway("r3") }); // When List <Runway> results = new List <Runway>(); for (int i = 0; i < 4; i++) { Runway r = tower.GetAvailableRunway(); if (r != null) { r.Status = RunwayStatus.Full; } results.Add(r); } // Then Assert.IsTrue(results[0].Name == "r1"); Assert.IsTrue(results[1].Name == "r2"); Assert.IsTrue(results[2].Name == "r3"); Assert.IsTrue(results[3] == null); }
public void T06_ControlTowerGivesNullRunwayIfNotPresentAndRequested() { // Given Runway runway = new Runway("runway 01", RunwayStatus.Full); ControlTower tower = new ControlTower(new Runway[] { runway }); // When Runway result = tower.GetAvailableRunway(); // Then Assert.IsTrue(result == null); }
public void T05_ControlTowerGivesEmptyRunwayIfPresentAndRequested() { // Given Runway runway = new Runway("runway 01", RunwayStatus.Empty); ControlTower tower = new ControlTower(new Runway[] { runway }); // When Runway result = tower.GetAvailableRunway(); // Then Assert.IsTrue(result != null); Assert.IsTrue(result.Name == runway.Name); }