コード例 #1
0
        public void Index_WithQuestion_ReturnsBingThisView()
        {
            // arrange
            var image = new ImageMetadata("/images/foo.jpg");
            var controller = new HomeController(image);

            // act
            var result = controller.Index("test") as ViewResult;

            // assert
            Assert.Same(image, result.Model);
            Assert.Equal("BingThis", result.ViewName);
        }
コード例 #2
0
        public void ImageMetadataPopulatesSelfFromReader()
        {
            // arrange
            var reader = new Mock<TextReader>();
            reader.Setup(r => r.ReadLine()).ReturnsInOrder("http://license-url/", "license type", "http://image-url/", "Author", new InvalidOperationException());

            // act
            var image = new ImageMetadata("/images/foo.jpg", reader.Object);

            // assert
            Assert.Equal("http://license-url/", image.LicenseUrl);
            Assert.Equal("license type", image.LicenseType);
            Assert.Equal("http://image-url/", image.SourceUrl);
            Assert.Equal("Author", image.Author);
        }
コード例 #3
0
 public HomeController(ImageMetadata imageOfTheDay)
 {
     _imageOfTheDay = imageOfTheDay;
 }