Beispiel #1
0
        public void Then_IsEnabledToAddNewJourneysPassWithJourneysAllowed()
        {
            mockFactory.ClearExpectations();

            bool expected = false;

            string salesAgent      = "Corporate";
            int    amountOfBooking = 1;

            var booking = BookingProvider.GetBookings(salesAgent, amountOfBooking).First();

            var maxJourneysAllowedByBooking = booking.Journeys.Count;

            _XXXLibraryConfigurationMock.Expects.One.GetProperty <int>(x => x.MaxJourneysAllowedByBooking).WillReturn(maxJourneysAllowedByBooking);

            bool actual = Sut.IsEnabledToAddNewJourneys(booking);

            Assert.IsTrue(actual == expected, "Expected to pass IsEnabledToAddNewJourneys feature.");

            mockFactory.VerifyAllExpectationsHaveBeenMet();
        }
        private void DeleteCreateJourneys(Booking firstBooking)
        {
            if (firstBooking.Journeys.Any())
            {
                firstBooking.Journeys.Clear();
            }

            if (!_BookingValidationDomainServices.IsEnabledToAddNewJourneys(firstBooking))
            {
                return;
            }

            var journey = new Journey
            {
                Arrival       = "AGP",
                ArrivalDate   = DateTime.UtcNow.AddDays(10),
                BookingId     = firstBooking.Id,
                Departure     = "MAD",
                Price         = 99.99M,
                DepartureDate = DateTime.UtcNow.AddDays(9)
            };

            firstBooking.AddJourney(journey);
        }
Beispiel #3
0
        public bool IsEnabledToAddNewJourneys(BookingDTO bookingDto)
        {
            var booking = _localMapper.Map <BookingDTO, Booking>(bookingDto);

            return(_bookingValidationDomainServices.IsEnabledToAddNewJourneys(booking));
        }