Exemplo n.º 1
0
        public void CreateBookingNullTest()
        {
            var testBookingService = new TestBookingService(GetBookings());
            var controller         = new BookingController(testBookingService,
                                                           new TestPaymentProvider(),
                                                           new TestLoggingService(),
                                                           new TestEmailService(), new TestHttpAuthorizationProvider());

            controller.Post(null);
        }
Exemplo n.º 2
0
        public void CreateBookingOneWayTest()
        {
            var testBookingService = new TestBookingService(GetBookings());
            var controller         = new BookingController(testBookingService,
                                                           new TestPaymentProvider(),
                                                           new TestLoggingService(),
                                                           new TestEmailService(),
                                                           new TestHttpAuthorizationProvider());

            var bookingViewModel = new BookingViewModel
            {
                CreditCard = new CreditCardViewModel
                {
                    CardHolder  = "John Snow",
                    CardNumber  = "5277056705647128",
                    ExpiryMonth = 12,
                    ExpiryYear  = 2016,
                    SecretCode  = 122
                },
                OutboundFlightScheduleId = 123,
                Price      = 544,
                Passengers = new List <PassengerViewModel>
                {
                    new PassengerViewModel
                    {
                        BirthDate      = new DateTime(1980, 02, 03),
                        Sex            = 1,
                        FirstName      = "John",
                        LastName       = "Snow",
                        PassportNumber = "2244333S"
                    },
                    new PassengerViewModel
                    {
                        BirthDate      = new DateTime(1989, 02, 03),
                        Sex            = 2,
                        FirstName      = "Taylor",
                        LastName       = "Swift",
                        PassportNumber = "224D4333S"
                    }
                }
            };

            Assert.AreEqual(controller.Post(bookingViewModel), 6543);
            Assert.AreEqual(testBookingService.CreatedBooking.Price, bookingViewModel.Price);
            Assert.IsFalse(string.IsNullOrEmpty(testBookingService.CreatedBooking.Pnr));
            Assert.AreEqual(testBookingService.CreatedBooking.Payment, 123);
            Assert.IsNotNull(testBookingService.CreatedBooking.Tickets);

            foreach (var ticket in testBookingService.CreatedBooking.Tickets)
            {
                //TODO: test tickets here
            }
        }