public static IEnumerable <object[]> GetMemberData()
 {
     yield return(new object[]
     {
         "<title>TEST_PAGE_TITLE</title>",
         TagHelperTestFactory.Create(
             seo => new CustomMetasTagHelper(seo),
             seo => seo.PageTitle = "TEST_PAGE_TITLE")
     });
 }
예제 #2
0
        public static IEnumerable <object[]> GetMemberData()
        {
            yield return(new object[]
            {
                //MetaTag(OgMetaName.Title, "TEST_SITE_NAME"),
                TagHelperTestFactory.Create(
                    seo => {
                    seo.SiteName = "TEST_SITE_NAME";

                    return new OgTitleTagHelper(seo);
                })
            });
        }
예제 #3
0
        public static IEnumerable <object[]> GetMemberData()
        {
            yield return(new object[]
            {
                MetaTag(MetaName.Robots, "TEST_ROBOTS"),
                TagHelperTestFactory.Create(
                    seo => new MetaRobotsTagHelper(seo),
                    seo => seo.MetaRobots = "TEST_ROBOTS")
            });

            yield return(new object[]
            {
                MetaTag(MetaName.Robots, "INDEX, FOLLOW"),
                TagHelperTestFactory.Create(
                    seo => new MetaRobotsTagHelper(seo),
                    seo => seo.SetMetaRobots(index: true, follow: true))
            });

            yield return(new object[]
            {
                MetaTag(MetaName.Robots, "INDEX, NOFOLLOW"),
                TagHelperTestFactory.Create(
                    seo => new MetaRobotsTagHelper(seo),
                    seo => seo.SetMetaRobots(index: true, follow: false))
            });

            yield return(new object[]
            {
                MetaTag(MetaName.Robots, "NOINDEX, FOLLOW"),
                TagHelperTestFactory.Create(
                    seo => new MetaRobotsTagHelper(seo),
                    seo => seo.SetMetaRobots(index: false, follow: true))
            });

            yield return(new object[]
            {
                MetaTag(MetaName.Robots, "NOINDEX, NOFOLLOW"),
                TagHelperTestFactory.Create(
                    seo => new MetaRobotsTagHelper(seo),
                    seo => seo.SetMetaRobots(index: false, follow: false))
            });
        }
        public static IEnumerable <object[]> GetMemberData()
        {
            yield return(new object[]
            {
                "<title>TEST_PAGE_TITLE</title>",
                TagHelperTestFactory.Create(
                    seo => new DocumentTitleTagHelper(seo),
                    seo => seo.PageTitle = "TEST_PAGE_TITLE")
            });

            yield return(new object[]
            {
                "<title>TEST_PAGE_TITLE - TEST_SITE_NAME</title>",
                TagHelperTestFactory.Create(
                    seo => {
                    seo.SiteName = "TEST_SITE_NAME";

                    return new DocumentTitleTagHelper(seo);
                },
                    seo => seo.PageTitle = "TEST_PAGE_TITLE")
            });
        }
        public void Process_TestData_ReturnsExpectedHtml()
        {
            // Arrange
            var tagHelper = TagHelperTestFactory.Create(
                seo => new CustomMetasTagHelper(seo),
                seo =>
            {
                seo.SetCustomMeta("CUSTOM_KEY1", "CUSTOM_VALUE1");
                seo.SetCustomMeta("CUSTOM_KEY2", "CUSTOM_VALUE1");
                seo.SetCustomMeta("CUSTOM_KEY2", "CUSTOM_VALUE2");
            });

            // Act
            var html = tagHelper.GetHtml("custom-metas");

            // Assert
            var expected =
                $"{MetaTagContentFirst("CUSTOM_KEY1", "CUSTOM_VALUE1")}" +
                $"{Environment.NewLine}" +
                $"{MetaTagContentFirst("CUSTOM_KEY2", "CUSTOM_VALUE2")}";

            Assert.Equal(expected, html);
        }
예제 #6
0
        public static IEnumerable <object[]> GetMemberData()
        {
            yield return(new object[]
            {
                MetaTag(MetaName.Description, "TEST_DESCRIPTION"),
                TagHelperTestFactory.Create(
                    seo => new MetaDescriptionTagHelper(seo),
                    seo => seo.MetaDescription = "TEST_DESCRIPTION"),
                "meta-description"
            });

            yield return(new object[]
            {
                MetaTag(MetaName.Keywords, "TEST_KEYWORDS"),
                TagHelperTestFactory.Create(
                    seo => new MetaKeywordsTagHelper(seo),
                    seo => seo.MetaKeywords = "TEST_KEYWORDS"),
                "meta-keywords"
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Description, "TEST_OG_DESCRIPTION"),
                TagHelperTestFactory.Create(
                    seo => new OgDescriptionTagHelper(seo),
                    seo => seo.OgDescription = "TEST_OG_DESCRIPTION"),
                "og-description"
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Description, "TEST_META_DESCRIPTION"),
                TagHelperTestFactory.Create(
                    seo => new OgDescriptionTagHelper(seo),
                    seo => seo.MetaDescription = "TEST_META_DESCRIPTION"),
                "og-description"
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Image, "TEST_OG_IMAGE"),
                TagHelperTestFactory.Create(
                    seo => new OgImageTagHelper(seo),
                    seo => seo.OgImage = "TEST_OG_IMAGE"),
                "og-image"
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.SiteName, "TEST_OG_SITENAME"),
                TagHelperTestFactory.Create(
                    seo => new OgSiteNameTagHelper(seo),
                    seo => seo.OgSiteName = "TEST_OG_SITENAME"),
                "og-description"
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.SiteName, "TEST_SITENAME"),
                TagHelperTestFactory.Create(
                    seo => new OgSiteNameTagHelper(seo),
                    seo => seo.SiteName = "TEST_SITENAME"),
                "og-description"
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Title, "TEST_OG_TITLE"),
                TagHelperTestFactory.Create(
                    seo => new OgTitleTagHelper(seo),
                    seo => seo.OgTitle = "TEST_OG_TITLE"),
                "og-title"
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Title, "TEST_PAGE_TITLE"),
                TagHelperTestFactory.Create(
                    seo => new OgTitleTagHelper(seo),
                    seo => seo.PageTitle = "TEST_PAGE_TITLE"),
                "og-title"
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Type, "TEST_OG_TYPE"),
                TagHelperTestFactory.Create(
                    seo => new OgTypeTagHelper(seo),
                    seo => seo.OgType = "TEST_OG_TYPE"),
                "og-type"
            });
        }
예제 #7
0
        public static IEnumerable <object[]> GetMemberData()
        {
            var urlHelper = SeoUrlHelperTestFactory.Create(
                new Uri("http://urlhelper.co/helper/page.html?query=123"));

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Url, "https://t.com/t/test/TEST_OG_URL?q=1&amp;query=&#xF6;"),
                TagHelperTestFactory.Create(
                    seo => new OgUrlTagHelper(seo, urlHelper),
                    seo => {
                    seo.SiteUrl = "https://t.com/t/";
                    seo.OgUrl = "test/TEST_OG_URL?q=1&query=ö";
                })
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Url, "http://urlhelper.co/test/TEST_OG_URL?q=1&amp;query=&#xF6;"),
                TagHelperTestFactory.Create(
                    seo => new OgUrlTagHelper(seo, urlHelper),
                    seo => {
                    seo.OgUrl = "/test/TEST_OG_URL?q=1&query=ö";
                })
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Url, "https://t.co/t/t/test/TEST_OG_URL?q=1&amp;query=&#xF6;"),
                TagHelperTestFactory.Create(
                    seo => new OgUrlTagHelper(seo, urlHelper),
                    seo => {
                    seo.SiteUrl = "https://t.co/t/t/";
                    seo.OgUrl = "test/TEST_OG_URL?q=1&query=ö";
                })
            });

            yield return(new object[]
            {
                string.Empty,
                TagHelperTestFactory.Create(
                    seo => new OgUrlTagHelper(seo, urlHelper),
                    seo => {
                    seo.SiteUrl = "https://t.com/test/";
                })
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Url, "https://t.co/test/test.html"),
                TagHelperTestFactory.Create(
                    seo => new OgUrlTagHelper(seo, urlHelper),
                    seo => {
                    seo.SiteUrl = "https://t.co/t/t/";
                    seo.OgUrl = "~/test/test.html";
                })
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Url, "https://t.com/t/test/TEST_OG_URL?q=1&amp;query=&#xF6;"),
                TagHelperTestFactory.Create(
                    seo => new OgUrlTagHelper(seo, urlHelper),
                    seo => {
                    seo.SiteUrl = "https://t.com/t/";
                    seo.LinkCanonical = "test/TEST_OG_URL?q=1&query=ö";
                })
            });

            yield return(new object[]
            {
                OpenGraphTag(OgMetaName.Url, "http://urlhelper.co/test/TEST_OG_URL?q=1&amp;query=&#xF6;"),
                TagHelperTestFactory.Create(
                    seo => new OgUrlTagHelper(seo, urlHelper),
                    seo => {
                    seo.LinkCanonical = "/test/TEST_OG_URL?q=1&query=ö";
                })
            });
        }