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); }
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); }