Esempio n. 1
0
        public void GetAllImages_ReturnsOkObjectResult_WithListOfImages()
        {
            // Arrange
            mockRepo.Setup(repo => repo.GetAllImages()).Returns(GetTestImages());
            var controller = new ImagesController(mockRepo.Object, mockGCS.Object, mockMapper.Object);

            // Act
            var result = controller.GetAllImages();

            // Assert
            var okObjectResult = Assert.IsType <OkObjectResult>(result.Result);
            var model          = Assert.IsAssignableFrom <IEnumerable <Image> >(
                okObjectResult.Value);

            Assert.Equal(GetTestImages().Count, model.Count());
        }