public void T005_UpdateAdvert_GeneralTest() { // Arrange _advertTypeRepository.Setup(x => x.GetSet()).Returns(new List <AdvertType>() { new AdvertType() { Mask = 1 } }); _advertRepository.Setup(x => x.Update(It.IsAny <Advert>())).Returns(new Advert() { Id = 1 }); _findPhotosById.Setup(x => x.Find(It.IsAny <IEnumerable <int> >())).Returns(new List <Photo>()); _photoService.Setup(x => x.AddAdvertToPhotos(It.IsAny <int>(), It.IsAny <IEnumerable <Photo> >())); // Act var updateAdvertService = new UpdateAdvertService(_advertRepository.Object, _advertTypeRepository.Object, _findPhotosById.Object, _photoService.Object); var result = updateAdvertService.UpdateAdvert(new CreateAdvertViewModel() { AdvertType = new AdvertTypeViewModel() { Mask = 1 } }, 1); // Assert Assert.AreEqual(result, 1); }
public void T004_UpdateAdvert_AdvertTypeNotFound_Exception() { // Arrange _advertTypeRepository.Setup(x => x.GetSet()).Returns(new List <AdvertType>()); // Act var updateAdvertService = new UpdateAdvertService(_advertRepository.Object, _advertTypeRepository.Object, _findPhotosById.Object, _photoService.Object); var result = updateAdvertService.UpdateAdvert(new CreateAdvertViewModel(), 1); // Assert }