Beispiel #1
0
        private static void FlightBookingSample()
        {
            FlightBooking flightBooking = new FlightBooking(Guid.NewGuid(),
                                                            DateTime.Now.AddDays(1), Guid.NewGuid());

            flightBooking.Reschedule(DateTime.Now.AddDays(3));
            flightBooking.Confirm();
            Console.WriteLine("Done");

            flightBooking.Reschedule(DateTime.Now.AddDays(4));
            Console.WriteLine("Done");
        }
        public void Departure_date_cannot_be_rescheduled_after_booking_confirmed_by_airline()
        {
            var id               = Guid.NewGuid();
            var customerId       = Guid.NewGuid();
            var initialDeparture = new DateTime(2015, 04, 22);
            var booking          = new FlightBooking(id, initialDeparture, customerId);

            booking.Confirm();

            var rescheduledDeparture = new DateTime(2015, 04, 23);

            try
            {
                booking.Reschedule(rescheduledDeparture);
            }
            catch (RescheduleRejected rr)
            {
                // Exception was thrown so test should pass
                return;
            }

            Assert.Fail("Reschedule was not rejected");
        }
Beispiel #3
0
        public void Departure_date_cannot_be_rescheduled_after_booking_confirmed_by_airline()
        {
            var id = Guid.NewGuid();
            var customerId = Guid.NewGuid();
            var initialDeparture = new DateTime(2015, 04, 22);
            var booking = new FlightBooking(id, initialDeparture, customerId);

            booking.Confirm();

            var rescheduledDeparture = new DateTime(2015, 04, 23);

            try
            {
                booking.Reschedule(rescheduledDeparture);
            }
            catch (RescheduleRejected rr)
            {
                // Exception was thrown so test should pass
                return;
            }

            Assert.Fail("Reschedule was not rejected");
        }