public void Should_ideally_left_70_percent_of_every_coach_available() { // setup mocks var firstBookingId = "75bcd15"; var secondBookingId = "9904fgG6"; var bookingReferenceProvider = ConfigureABookingReferenceProviderMock(new[] { firstBookingId, secondBookingId }); var trainId = "express_2000"; var trainDataProvider = new TrainDataServiceMock(TrainProviderHelper.GetTrainWith2CoachesAnd2IndividualSeatsAvailable(trainId)); // act // First reservation var ticketOffice = new TicketOffice(bookingReferenceProvider, trainDataProvider); var firstReservation = ticketOffice.MakeReservation(new ReservationRequest(trainId, 1)); // Must be located in the remaining seat of 1st coach Check.That(firstReservation.TrainId).IsEqualTo(trainId); Check.That(firstReservation.BookingReference.Value).IsEqualTo(firstBookingId); Check.That(firstReservation.Seats).ContainsExactly(new Seat("A", 7)); // Second reservation var secondReservation = ticketOffice.MakeReservation(new ReservationRequest(trainId, 1)); // Must be located in the remaining seat of 1st coach Check.That(secondReservation.TrainId).IsEqualTo(trainId); Check.That(secondReservation.BookingReference.Value).IsEqualTo(secondBookingId); Check.That(secondReservation.Seats).ContainsExactly(new Seat("B", 7)); }
public void Should_reserve_seats_in_the_same_coach() { // setup mocks var firstBookingId = "75bcd15"; var secondBookingId = "9904fgG6"; var bookingReferenceProvider = ConfigureABookingReferenceProviderMock(new[] { firstBookingId, secondBookingId }); var trainId = "express_2000"; var trainDataProvider = new TrainDataServiceMock(TrainProviderHelper.GetTrainWith2CoachesOf10And1Then2SeatsAvailable(trainId)); // act var ticketOffice = new TicketOffice(bookingReferenceProvider, trainDataProvider); var firstReservation = ticketOffice.MakeReservation(new ReservationRequest(trainId, 2)); // Must be located in the remaining seats of the 2nd coach Check.That(firstReservation.TrainId).IsEqualTo(trainId); Check.That(firstReservation.BookingReference.Value).IsEqualTo(firstBookingId); Check.That(firstReservation.Seats).ContainsExactly(new Seat("B", 6), new Seat("B", 7)); }
public TrainDataProviderAdapter() { trainDataService = new TrainDataServiceMock(TrainProviderHelper.GetTrainWith2CoachesAnd2IndividualSeatsAvailable("A-train")); }