Example #1
0
        public void InsertTour_WithValidDetailsWithFutureReminder_NotInserted()
        {
            TourViewModel tourViewModel = TourMockData.GetTourViewModel();

            tourViewModel.ReminderDate = new DateTime(14, 8, 14);
            mockTourRepository.Setup(tr => tr.Insert(It.IsAny <Tour>())).Verifiable("Unable to insert Tour");
            mockUnitOfWork.Setup(tr => tr.Commit()).Returns(new Tour()
            {
                Id = NEW_TOUR_ID
            });
            InsertTourRequest request = new InsertTourRequest()
            {
                TourViewModel = TourMockData.CreateMockTourWithCustomValues(mockRepository,
                                                                            0, 2, 1, 2, new DateTime(2015, 1, 31), new List <ReminderType>()
                {
                    ReminderType.Email
                }, new DateTime(2014, 12, 31)).Object
            };
            InsertTourResponse response = new InsertTourResponse();

            response = tourService.InsertTour(request);
            mockRepository.VerifyAll();
            Assert.AreEqual(null, response.Exception);
            Assert.AreNotEqual(typeof(ArgumentNullException), response.Exception);
        }
Example #2
0
        public void InsertTour_WithoutTourType_NotInserted()
        {
            TourViewModel tourViewModel = TourMockData.GetTourViewModel();

            tourViewModel.TourType = 2;
            mockTourRepository.Setup(tr => tr.Insert(It.IsAny <Tour>())).Verifiable("Unable to insert Tour");
            InsertTourRequest request = new InsertTourRequest()
            {
                TourViewModel = TourMockData.CreateMockTourWithCustomValues(mockRepository, 0, 2, 0, 10, new DateTime()).Object
            };
            InsertTourResponse response = new InsertTourResponse();

            //InsertTourResponse response = tourService.InsertTour(new InsertTourRequest() { TourViewModel = actionViewModel });
            response = tourService.InsertTour(request);

            Assert.AreNotEqual(null, response.Exception);
        }
Example #3
0
        //[TestMethod]
        public void InsertTour_WithValidDetailsWithoutReminder_SuccessfullyInserted()
        {
            TourViewModel tourViewModel = TourMockData.GetTourViewModel();

            mockTourRepository.Setup(tr => tr.Insert(It.IsAny <Tour>())).Verifiable("Unable to insert Tour");
            mockUnitOfWork.Setup(tr => tr.Commit()).Returns(new Tour()
            {
                Id = NEW_TOUR_ID
            });
            InsertTourRequest request = new InsertTourRequest()
            {
                TourViewModel = TourMockData.CreateMockTourWithCustomValues(mockRepository, 10, 2, 1, 5, new DateTime()).Object
            };
            InsertTourResponse response = new InsertTourResponse();

            //InsertTourResponse response = tourService.InsertTour(new InsertTourRequest() { TourViewModel = tourViewModel });
            //response = tourService.InsertTour(request);
            mockRepository.VerifyAll();
            Assert.AreEqual(null, response.Exception);
            Assert.AreNotEqual(typeof(ArgumentNullException), response.Exception);
        }