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); }
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); }
public HomeController(ImageMetadata imageOfTheDay) { _imageOfTheDay = imageOfTheDay; }