예제 #1
0
        public void SeoMetaRobotsIndex_EmptyArgument_ReturnsNull()
        {
            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

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

            // Assert
            Assert.Null(html);
        }
예제 #2
0
        public void SeoMetaDescription_EmptyArgument_ReturnsNull()
        {
            // Arrange
            var htmlHelper = HtmlHelperTestFactory.Create();

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

            // Assert
            Assert.Null(html);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
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);
        }
예제 #7
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);
        }