public void Then_ValidationFailWhenAgency()
        {
            mockFactory.ClearExpectations();

            _BookingFeaturesDomainServicesMocked.Expects.One.Method(x => x.IsAgency(null)).WithAnyArguments().WillReturn(true);

            Booking booking = GetNewBooking("agency", 2);

            Sut.Validate(booking);

            mockFactory.VerifyAllExpectationsHaveBeenMet();
        }
Example #2
0
        public void ClearExpectation()
        {
            MockFactory            testee = new MockFactory();
            Mock <ISelfDescribing> mock   = testee.CreateMock <ISelfDescribing>();

            mock.Expects.One.Method(_ => _.DescribeTo(null));

            testee.ClearExpectations();

            testee.VerifyAllExpectationsHaveBeenMet();
        }
Example #3
0
        public void Then_BookingIsCanceled()
        {
            mockFactory.ClearExpectations();

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

            var bookingsToCancel       = BookingProvider.GetBookings(salesAgent, amountOfBooking);
            var firstModificationDate  = bookingsToCancel.SingleOrDefault().Modified;
            var journeysAmountToCancel = bookingsToCancel.SingleOrDefault().Journeys.Count;

            _BookingRepository.Expects.One.Method(x => x.Get(null, null, null, null, null, false)).WithAnyArguments().WillReturn(bookingsToCancel);
            _JourneyRepository.Expects.Exactly(journeysAmountToCancel).Method(x => x.Delete(null)).WithAnyArguments();
            _BookingRepository.Expects.One.Method(x => x.UpdateRootEntity(null)).WithAnyArguments();
            _UnitOfWorkBookingCanceler.Expects.One.Method(x => x.Save()).WillReturn(journeysAmountToCancel);

            _BookingFeaturesDomainServices.Expects.One.Method(x => x.IsAgency(null)).WithAnyArguments().WillReturn(false);

            Sut.CancelBooking(bookingsToCancel.First().Id);

            Assert.IsTrue(bookingsToCancel.SingleOrDefault().Modified > firstModificationDate, "Property Modified in Booking was not modified.");

            mockFactory.VerifyAllExpectationsHaveBeenMet();
        }
Example #4
0
        public void Then_IsAgencyPassWithAgencyAgent()
        {
            mockFactory.ClearExpectations();

            bool expected = true;

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

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

            _XXXLibraryConfigurationMock.Expects.One.GetProperty <string>(x => x.PartialCodeForAgencyAgent).WillReturn("agency");

            bool actual = Sut.IsAgency(booking);

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

            mockFactory.VerifyAllExpectationsHaveBeenMet();
        }
 public void End()
 {
     _factory.ClearExpectations();
 }
Example #6
0
 public void Cleanup()
 {
     factory.VerifyAllExpectationsHaveBeenMet();
     factory.ClearExpectations();
 }
Example #7
0
 protected void Cleanup()
 {
     Factory.VerifyAllExpectationsHaveBeenMet();
     Factory.ClearExpectations();
 }
Example #8
0
 public void Cleanup()
 {
     _mockFactory.ClearExpectations();
 }