Esempio n. 1
0
            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);
            }
Esempio n. 2
0
            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: *");
            }
Esempio n. 3
0
            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");
            }
Esempio n. 4
0
            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>();
            }