Exemple #1
0
        public void TestBasicFeature()
        {
            var rawHtml = @"
<head>
    <title>This is title in head metadata</title>
</head>
<body>
    <h1> This is Title </h1>
    <p class='data-searchable'> Hello World,
    Microsoft
    </p>
    <article>
        <h1>
            This is article title
        </h1>
        docfx can do anything...
    </article>
</body>
";
            var html    = new HtmlDocument();

            html.LoadHtml(rawHtml);
            var href = "http://dotnet.github.io/docfx";
            var item = ExtractSearchIndexFromHtml.ExtractItem(html, href);

            Assert.True(item.Equals(new SearchIndexItem {
                Href = href, Title = "This is title in head metadata", Keywords = "Hello World, Microsoft This is article title docfx can do anything..."
            }));
        }
Exemple #2
0
        public void TestEmptyItem()
        {
            var rawHtml = @"
<head>
    <title>This is title in head metadata</title>
</head>
<body>
</body>
";
            var html    = new HtmlDocument();

            html.LoadHtml(rawHtml);
            var href = "http://dotnet.github.io/docfx";
            var item = ExtractSearchIndexFromHtml.ExtractItem(html, href);

            Assert.True(item.Equals(new SearchIndexItem {
                Href = href, Title = "This is title in head metadata", Keywords = string.Empty
            }));
        }
Exemple #3
0
        public void TestSearchableClass()
        {
            var rawHtml = @"
<head>
    <title>This is title in head metadata</title>
</head>
<body>
    <p class='data-searchable'>Cooooooool!</p>
</body>
";
            var html    = new HtmlDocument();

            html.LoadHtml(rawHtml);
            var href = "http://dotnet.github.io/docfx";
            var item = ExtractSearchIndexFromHtml.ExtractItem(html, href);

            Assert.True(item.Equals(new SearchIndexItem {
                Href = href, Title = "This is title in head metadata", Keywords = "Cooooooool!"
            }));
        }