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");
        }
예제 #2
0
        public IActionResult GetImage(int imageId)
        {
            var image = imageProvider.FindImage(imageId);

            if (image == null)
            {
                return(NotFound());
            }
            return(Redirect(image.ImageUrl));
        }