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));
        }
Example #2
0
 public TrainDataProviderAdapter()
 {
     trainDataService = new TrainDataServiceMock(TrainProviderHelper.GetTrainWith2CoachesAnd2IndividualSeatsAvailable("A-train"));
 }
        public void Should_return_the_number_of_coach()
        {
            var train = TrainProviderHelper.GetTrainWith2CoachesAnd2IndividualSeatsAvailable("train43");

            Check.That(train.CoachCount).IsEqualTo(2);
        }