Esempio n. 1
0
        public void Test_EditTour()
        {
            Tour tour = (Tour)_tourList[0];

            _tourDalMock.Setup(s => s.EditTour(tour));

            _tourService.EditTour(tour);

            _tourDalMock.Verify(s => s.EditTour(tour), Times.Once);
        }
Esempio n. 2
0
        public void EditTour_CapableAction()
        {
            TourDTO tourDTO = new TourDTO()
            {
                Id = 1, Name = "Aq", TourTypeId = 6, InfoId = 3
            };

            mock.Setup(m => m.Tours.GetAll()).Returns(tours);
            mock.Setup(m => m.TourTypes.Get(tourDTO.TourTypeId)).Returns(type);
            mock.Setup(m => m.TourInfos.Get(tourDTO.InfoId)).Returns(info);
            TourService tourService = new TourService(mock.Object);
            var         mapper      = new MapperConfiguration(cfg => cfg.CreateMap <TourDTO, Tour>()).CreateMapper();
            var         tour        = mapper.Map <TourDTO, Tour>(tourDTO);

            tourService.EditTour((tourDTO));//JsonSerializer.Serialize

            mock.Verify(lw => lw.Tours.Update(It.IsAny <Tour>()),
                        Times.Once());
            Assert.AreNotEqual(tour, tours.Where(p => p.Id == tourDTO.Id));
        }