private void ShouldReturnSitemap() { var sitemap = new Sitemap(); var sitemapFactoryMock = new Mock <ISitemapFactory>(MockBehavior.Strict); sitemapFactoryMock.Setup(sf => sf.Create()).Returns(sitemap); var seoController = new SeoController(GetRobotsTxtFactory(), sitemapFactoryMock.Object); IActionResult sitemapResult = seoController.GetSitemap(); sitemapResult.As <ObjectResult>().Value.Should().BeSameAs(sitemap); }
private void ShouldReturnCorrectContent() { var robotsFactoryMock = new Mock <IRobotsTxtFactory>(MockBehavior.Strict); robotsFactoryMock.Setup(rf => rf.Create()).Returns("User-agent: *"); var seoController = new SeoController(robotsFactoryMock.Object, GetSitemapFactory()); IActionResult robotsResult = seoController.GetRobots(); robotsResult.As <ContentResult>().Content.Should().BeEquivalentTo("User-agent: *"); }
private void ShouldReturnCorrectContentType() { var robotsFactoryMock = new Mock <IRobotsTxtFactory>(MockBehavior.Strict); robotsFactoryMock.Setup(rf => rf.Create()).Returns(string.Empty); var seoController = new SeoController(robotsFactoryMock.Object, GetSitemapFactory()); IActionResult robotsResult = seoController.GetRobots(); robotsResult.As <ContentResult>().ContentType.Should().BeEquivalentTo("text/plain; charset=utf-8"); }
private void ShouldReturnContentResult() { var robotsFactoryMock = new Mock <IRobotsTxtFactory>(MockBehavior.Strict); robotsFactoryMock.Setup(rf => rf.Create()).Returns(string.Empty); var seoController = new SeoController(robotsFactoryMock.Object, GetSitemapFactory()); IActionResult robotsResult = seoController.GetRobots(); robotsResult.Should().BeOfType <ContentResult>(); }