public void T002_UpdateAdvert_GeneralTest() { // Arrange _advertTypeRepository.Setup(x => x.GetSet()).Returns(new List <AdvertType>() { new AdvertType() { Mask = 1 } }); _advertRepository.Setup(x => x.Add(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 createAdvertService = new CreateAdvertService(_advertRepository.Object, _photoService.Object, _advertTypeRepository.Object, _findPhotosById.Object); var result = createAdvertService.CreateAdvert(new CreateAdvertViewModel() { AdvertType = new AdvertTypeViewModel() { Mask = 1 } }); // Assert Assert.AreEqual(result, 1); }
public void T001_UpdateAdvert_AdvertTypeNotFound_Exception() { // Arrange _advertTypeRepository.Setup(x => x.GetSet()).Returns(new List <AdvertType>()); // Act var createAdvertService = new CreateAdvertService(_advertRepository.Object, _photoService.Object, _advertTypeRepository.Object, _findPhotosById.Object); var result = createAdvertService.CreateAdvert(new CreateAdvertViewModel()); // Assert }