private static void SetupAirlineData() { _flightRuleService = new FlightRuleService(); _availablePlaneService = new AvailablePlaneService(); _availablePlaneService.Planes = new List <Plane>(); _availablePlaneService.Planes.Add(new Plane { Id = 124, Name = "Bombardier Q400", NumberOfSeats = 15 }); _availablePlaneService.Planes.Add(new Plane { Id = 125, Name = "ATR 640", NumberOfSeats = 20 }); var londonToParis = new FlightRoute("London", "Paris") { BaseCost = 50, BasePrice = 100, LoyaltyPointsGained = 5, MinimumTakeOffPercentage = 0.7 }; _scheduledFlight = new ScheduledFlight( londonToParis, _flightRuleService, _availablePlaneService); _scheduledFlight.SetAircraftForRoute(new Plane { Id = 123, Name = "Antonov AN-2", NumberOfSeats = 12 }); }
public ScheduledFlight(FlightRoute flightRoute, FlightRuleService flightRuleService, AvailablePlaneService availablePlaneService) { FlightRoute = flightRoute; FlightRuleService = flightRuleService; AvailablePlaneService = availablePlaneService; Passengers = new List <Passenger>(); }
private string checkForPlanesWithMoreSeats(int seatsTaken) { var availablePlanes = AvailablePlaneService .GetWithMoreSeats(seatsTaken); var result = string.Empty; if (availablePlanes != null) { result += string.Format("{0}Other more suitable aircraft are:{1}", _newLine, _newLine); foreach (var plane in availablePlanes) { result += string.Format("{0} could handle this flight.{1}", plane.Name, _newLine); } } return(result); }