public void Should_ReturnImageFromRepository() { imageRepositorySetup.Setup(ir => ir.Query()) .Returns(new[] { new ImageDb { ImageUrl = "Test", ImageId = 1 } }.AsQueryable()); var image = imageProvider.FindImage(1); image.Should().NotBeNull(); image.ImageId.Should().Be(1); image.ImageUrl.Should().Be("Test"); }
public IActionResult GetImage(int imageId) { var image = imageProvider.FindImage(imageId); if (image == null) { return(NotFound()); } return(Redirect(image.ImageUrl)); }