Пример #1
0
        public void GetImage_ProductDoesNotExist_ReturnsNull()
        {
            //Arange
            var productsRepoMock  = RepositoryHelper.CreateProductsWithImageRepoMock();
            var productController = new ProductController(productsRepoMock.Object);

            //Act
            var result = productController.GetImage(100);

            //Assert
            Assert.IsNull(result);
        }
Пример #2
0
        public void GetImage_ProductExists_ReturnsImage()
        {
            //Arange
            var productsRepoMock  = RepositoryHelper.CreateProductsWithImageRepoMock();
            var productController = new ProductController(productsRepoMock.Object);

            //Act
            var result = productController.GetImage(2);

            //Assert
            Assert.IsNotNull(result);
            Assert.IsInstanceOfType(result, typeof(FileContentResult));
            Assert.AreEqual("image/png", result.ContentType);
        }