Exemplo n.º 1
0
            public void ProcessAllBookingsByCheckInDateAndChannelScenarioIsSuccessful()
            {
                const BookingScenarioTypeEnum CHANNEL_SCENARIO = BookingScenarioTypeEnum.VPayment;
                const string EVENT_NOTES = "Auto generated notes";
                const int BOOKING_ID = 1;

                var checkinDate = DateTime.Today;

                var bookingDao = new Mock<IBookingDao>();
                var eventTrackingManager = new Mock<IEventTrackingManager>();
                var bookingManager = new BookingManager { BookingDao = bookingDao.Object, EventTrackingManager = eventTrackingManager.Object };               
                var bookingIds = new List<int>
                                   {
                                       1
                                   };

                bookingDao.Setup(b => b.GetBookingIdsByCheckInDateAndChannelScenario(It.Is<DateTime>(i => i == checkinDate), It.Is<BookingScenarioTypeEnum>(i => i == CHANNEL_SCENARIO))).Returns(bookingIds);

                eventTrackingManager.Setup(
                    e =>
                    e.CreateBookingEvent(It.Is<int>(i => i == BOOKING_ID),
                                         It.Is<BookingEventType>(i => i == BookingEventType.Modified),
                                         It.Is<string>(i => i == EVENT_NOTES)));

                var processCount = bookingManager.ProcessAllBookingsByCheckInDateAndChannelScenario(checkinDate, CHANNEL_SCENARIO, EVENT_NOTES);

                Assert.AreEqual(1, processCount, "Invalid number of bookings processed");

                bookingDao.VerifyAll();
                eventTrackingManager.VerifyAll();
            }