public void Booking_A_Full_Flight(int capacity) { Airport sourceAirport = Airport.CreateAirport("Lagos"); Airport destinationAirport = Airport.CreateAirport("Berlin"); Airline theAirline = AirlineFactory.CreateAirline("passenger", "Emirates"); sourceAirport.RegisterAirline(theAirline); DateTime flightTime = new DateTime(2019, 7, 8); Flight flight = new Flight() { Destination = "Berlin", FlightCapacity = capacity, FlightTime = flightTime }; theAirline.RegisterAFlight(flight); string[] passengerNames = { "Daniel", "Zuckerberg", "Bezos", "Page", "Gates" }; for (int i = 0; i < capacity; i++) { Passenger passenger = new Passenger() { FirstName = RandomString(8), Source = sourceAirport, Destination = destinationAirport, }; passenger.BookFlight("Emirates", flightTime, "Economy"); } Passenger latePassenger = new Passenger() { FirstName = "Gates", Source = sourceAirport, Destination = destinationAirport, }; string expectedResponse = $"Sorry {latePassenger.FirstName}, There are no more seats on the flight going to {latePassenger.Destination.Location}"; string actualResponse = latePassenger.BookFlight("Emirates", flightTime, "Economy"); StringAssert.AreEqualIgnoringCase(expectedResponse, actualResponse); }
public void BookFlightTest() { pass1.BookFlight(BA213, 21); Assert.AreEqual(BA213, pass1.BookedFlight); Assert.AreEqual(21, pass1.Seat); }