コード例 #1
0
            public void FindsLinksInHead(string tag, string link)
            {
                // Given
                IDocument  document = new TestDocument($"<html><head>{tag}</head><body></body></html>");
                HtmlParser parser   = new HtmlParser();
                ConcurrentDictionary <string, ConcurrentBag <Tuple <FilePath, string> > > links =
                    new ConcurrentDictionary <string, ConcurrentBag <Tuple <FilePath, string> > >();

                // When
                ValidateLinks.GatherLinks(document, parser, links);

                // Then
                Assert.That(links.Count, Is.EqualTo(1));
                Assert.That(links.First().Key, Is.EqualTo(link));
            }
コード例 #2
0
            public async Task FindsLinksInHead(string tag, string link)
            {
                // Given
                TestExecutionContext context  = new TestExecutionContext();
                TestDocument         document = new TestDocument($"<html><head>{tag}</head><body></body></html>");
                HtmlParser           parser   = new HtmlParser();
                ConcurrentDictionary <string, ConcurrentBag <(string source, string outerHtml)> > links =
                    new ConcurrentDictionary <string, ConcurrentBag <(string source, string outerHtml)> >();

                // When
                await ValidateLinks.GatherLinksAsync(document, context, parser, links);

                // Then
                Assert.That(links.Count, Is.EqualTo(1));
                Assert.That(links.First().Key, Is.EqualTo(link));
            }