Ejemplo n.º 1
0
        public void SeoMetaRobotsIndex_EmptyArgument_ReturnsNull()
        {
            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

            // Act
            var html = htmlHelper.SeoMetaRobotsIndex();

            // Assert
            Assert.Null(html);
        }
Ejemplo n.º 2
0
        public void SeoLinkCanonical_EmptyArgument_ReturnsNull()
        {
            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

            // Act
            var html = htmlHelper.SeoLinkCanonical();

            // Assert
            Assert.Null(html);
        }
Ejemplo n.º 3
0
        public void SeoMetaDescription_EmptyArgument_ReturnsNull()
        {
            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

            // Act
            var html = htmlHelper.SeoMetaDescription();

            // Assert
            Assert.Null(html);
        }
Ejemplo n.º 4
0
        public void SeoLinkCanonical_WithArgument_ReturnsHtmlContainingAbsoluteUrl()
        {
            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

            // Act
            var html = htmlHelper.SeoLinkCanonical(TestData.TestLinkCanonical);

            // Assert
            bool htmlContainsAbsoluteUrl = html.Contains(RequestContextTestFactory.Domain);

            Assert.True(htmlContainsAbsoluteUrl);
        }
Ejemplo n.º 5
0
        public void SeoLinkCanonical_WithArgument_ReturnsHtmlContainingValue()
        {
            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

            // Act
            var html = htmlHelper.SeoLinkCanonical(TestData.TestLinkCanonical);

            // Assert
            bool htmlContainsValue = html.Contains(TestData.TestLinkCanonical);

            Assert.True(htmlContainsValue);
        }
Ejemplo n.º 6
0
        public void SeoMetaKeywords_WithArgument_ReturnsHtmlContainingValue()
        {
            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

            // Act
            var html = htmlHelper.SeoMetaKeywords(TestData.TestMetaKeywords);

            // Assert
            bool htmlContainsValue = html.Contains(TestData.TestMetaKeywords);

            Assert.True(htmlContainsValue);
        }
Ejemplo n.º 7
0
        public void SeoLinkCanonical_WithLinkCanonicalBase_ReturnsHtmlContainingLinkCanonicalBase()
        {
            const string LinkCanonicalBase = "https://linkcanonical.co/base/";

            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

            // Act
            var html = htmlHelper.SeoLinkCanonical(TestData.TestLinkCanonical, linkCanonicalBase: LinkCanonicalBase);

            // Assert
            bool htmlContainsLinkCanonicalBase = html.Contains(LinkCanonicalBase);

            Assert.True(htmlContainsLinkCanonicalBase);
        }
Ejemplo n.º 8
0
        public void SeoTitle_EmptyArgumentWithBaseTitleInSeoHelper_ReturnsHtmlContainingValue()
        {
            // Arrange
            var viewContext = ViewContextTestFactory.Create();
            var htmlHelper  = HtmlHelperTestFactory.Create(viewContext);
            var seoHelper   = SeoHelperTestFactory.Create(viewContext);

            seoHelper.BaseTitle = TestData.TestBaseTitle;

            // Act
            var html = htmlHelper.SeoTitle();

            // Assert
            bool htmlContainsValue = html.Contains(TestData.TestBaseTitle);

            Assert.True(htmlContainsValue);
        }
Ejemplo n.º 9
0
        public void SeoLinkCanonical_EmptyArgumentWithValueInSeoHelper_ReturnsHtmlContainingValue()
        {
            // Arrange
            var viewContext = ViewContextTestFactory.Create();
            var htmlHelper  = HtmlHelperTestFactory.Create(viewContext);
            var seoHelper   = SeoHelperTestFactory.Create(viewContext);

            seoHelper.LinkCanonical = $"{TestData.TestLinkCanonical}";

            // Act
            var html = htmlHelper.SeoLinkCanonical();

            // Assert
            bool htmlContainsValue = html.Contains(TestData.TestLinkCanonical);

            Assert.True(htmlContainsValue);
        }
Ejemplo n.º 10
0
        public void SeoMetaKeywords_EmptyArgumentWithValueInSeoHelper_ReturnsHtmlContainingValue()
        {
            // Arrange
            var viewContext = ViewContextTestFactory.Create();
            var htmlHelper  = HtmlHelperTestFactory.Create(viewContext);
            var seoHelper   = SeoHelperTestFactory.Create(viewContext);

            seoHelper.MetaKeywords = TestData.TestMetaKeywords;

            // Act
            var html = htmlHelper.SeoMetaKeywords();

            // Assert
            bool htmlContainsValue = html.Contains(TestData.TestMetaKeywords);

            Assert.True(htmlContainsValue);
        }
Ejemplo n.º 11
0
        SeoLinkCanonical_WithAppRelativeLinkCanonicalAndLinkCanonicalBase_ReturnsHtmlNotContainingAppRelativeChar()
        {
            const string LinkCanonicalBase = "https://linkcanonical.co/base/";

            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

            // Act
            var html = htmlHelper.SeoLinkCanonical(
                TestData.TestAppRelativeLinkCanonical,
                linkCanonicalBase: LinkCanonicalBase);

            // Assert
            bool htmlContainsAppRelativeChar = html.Contains("~");

            Assert.False(htmlContainsAppRelativeChar);
        }
Ejemplo n.º 12
0
        public void SeoMetaRobotsIndex_WithArgument_ReturnsHtmlContainingValue(
            RobotsIndex robotsIndex,
            string expectedContent)
        {
            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

            // Act
            var html = htmlHelper.SeoMetaRobotsIndex(robotsIndex);

            // Assert
            bool htmlContainsRobots          = html.Contains("robots");
            var  metaContent                 = RobotsIndexManager.GetMetaContent(robotsIndex);
            bool htmlContainsMetaContent     = html.Contains(metaContent);
            bool htmlContainsExpectedContent = html.Contains(expectedContent);

            Assert.True(htmlContainsRobots);
            Assert.True(htmlContainsMetaContent);
            Assert.True(htmlContainsExpectedContent);
        }
Ejemplo n.º 13
0
        public void SeoMetaRobotsIndex_EmptyArgumentWithMetaRobotsNoIndexInSeoHelper_ReturnsHtmlContainingValue()
        {
            // Arrange
            var viewContext = ViewContextTestFactory.Create();
            var htmlHelper  = HtmlHelperTestFactory.Create(viewContext);
            var seoHelper   = SeoHelperTestFactory.Create(viewContext);

            seoHelper.MetaRobotsNoIndex = true;

            // Act
            var html = htmlHelper.SeoMetaRobotsIndex();

            // Assert
            bool htmlContainsRobots      = html.Contains("robots");
            var  defaultRobotsNoIndex    = RobotsIndexManager.GetMetaContent(RobotsIndexManager.DefaultRobotsNoIndex);
            bool htmlContainsMetaContent = html.Contains(defaultRobotsNoIndex);

            Assert.True(htmlContainsRobots);
            Assert.True(htmlContainsMetaContent);
        }
Ejemplo n.º 14
0
        SeoLinkCanonical_EmptyArgumentWithAppRelativeValueInSeoHelper_ReturnsHtmlContainingValueAndIsAbsolute()
        {
            // Arrange
            var viewContext = ViewContextTestFactory.Create();
            var htmlHelper  = HtmlHelperTestFactory.Create(viewContext);
            var seoHelper   = SeoHelperTestFactory.Create(viewContext);

            seoHelper.LinkCanonical = TestData.TestAppRelativeLinkCanonical;

            // Act
            var html = htmlHelper.SeoLinkCanonical();

            // Assert
            bool htmlContainsValue  = html.Contains(TestData.TestLinkCanonical);
            bool htmlContainsDomain = html.Contains(RequestContextTestFactory.Domain);
            bool htmlContainsAppRelativeCharacter = html.Contains("~");

            Assert.True(htmlContainsValue);
            Assert.True(htmlContainsDomain);
            Assert.False(htmlContainsAppRelativeCharacter);
        }
Ejemplo n.º 15
0
        public void SeoMetaRobotsIndex_EmptyArgumentWithValuesInSeoHelper_ReturnsHtmlContainingValue(
            RobotsIndex robotsIndex,
            string expectedContent)
        {
            // Arrange
            var viewContext = ViewContextTestFactory.Create();
            var htmlHelper  = HtmlHelperTestFactory.Create(viewContext);
            var seoHelper   = SeoHelperTestFactory.Create(viewContext);

            seoHelper.MetaRobotsIndex = robotsIndex;

            // Act
            var html = htmlHelper.SeoMetaRobotsIndex();

            // Assert
            bool htmlContainsRobots          = html.Contains("robots");
            var  metaContent                 = RobotsIndexManager.GetMetaContent(robotsIndex);
            bool htmlContainsMetaContent     = html.Contains(metaContent);
            bool htmlContainsExpectedContent = html.Contains(expectedContent);

            Assert.True(htmlContainsRobots);
            Assert.True(htmlContainsMetaContent);
            Assert.True(htmlContainsExpectedContent);
        }