Esempio n. 1
0
        public void Given_ProductIdAndPhotoForCreationWithoutImage_When_AddPhotoForProduct_ThenReturn_BadRequest_BecausePhotoFileWasntSent()
        {
            //Arrange
            int productId           = 1;
            var photoForCreationDto = new PhotoForCreationDto();

            _mockedUnitOfWork.Setup(s => s.Product.GetWithPhotosOnly(productId))
            .ReturnsAsync(new Product());


            //Act
            var result = _cut.AddPhotoForProduct(productId, photoForCreationDto).Result;

            //Assert
            result.Should().BeOfType <BadRequestObjectResult>();
            result.As <BadRequestObjectResult>().Value.Should().Be("Photo file wasn't sent");

            _mockedUnitOfWork.Verify(v => v.Product.GetWithPhotosOnly(productId), Times.Once);
        }