Пример #1
0
        public ActionResult DeletePhoto(int PhotoID, int ProductID)
        {
            var productPhotoService = new ProductPhotoService();

            productPhotoService.Delete(new ProductPhoto {
                PhotoID = PhotoID
            });
            return(RedirectToAction("ProductUpdate/" + ProductID, "admin"));
        }
Пример #2
0
        public async void Delete()
        {
            var mock  = new ServiceMockFacade <IProductPhotoRepository>();
            var model = new ApiProductPhotoRequestModel();

            mock.RepositoryMock.Setup(x => x.Delete(It.IsAny <int>())).Returns(Task.CompletedTask);
            var service = new ProductPhotoService(mock.LoggerMock.Object,
                                                  mock.RepositoryMock.Object,
                                                  mock.ModelValidatorMockFactory.ProductPhotoModelValidatorMock.Object,
                                                  mock.BOLMapperMockFactory.BOLProductPhotoMapperMock,
                                                  mock.DALMapperMockFactory.DALProductPhotoMapperMock,
                                                  mock.BOLMapperMockFactory.BOLProductProductPhotoMapperMock,
                                                  mock.DALMapperMockFactory.DALProductProductPhotoMapperMock);

            ActionResponse response = await service.Delete(default(int));

            response.Should().NotBeNull();
            mock.RepositoryMock.Verify(x => x.Delete(It.IsAny <int>()));
            mock.ModelValidatorMockFactory.ProductPhotoModelValidatorMock.Verify(x => x.ValidateDeleteAsync(It.IsAny <int>()));
        }