Esempio n. 1
0
        public void SimpleAHref(string url, string href, string expected)
        {
            var html = string.Format("<html><body><div><a href='{0}'>a</a></div></body></html>", href);
            var links = new LinkExtractor().ExtractLinks(new Uri(url), Read(html), MediaTypeNames.Text.Html);

            Assert.AreElementsEqualIgnoringOrder(new[] { expected }, links.Select(l => l.ToString()));
        }
Esempio n. 2
0
        public void AHrefWithBase(string baseUrl, string href, string expected)
        {
            var html = string.Format("<html><head><base href='{0}'></head><body><div><a href='{1}'>a</a></div></body></html>", baseUrl, href);
            var links = new LinkExtractor().ExtractLinks(new Uri("http://y.com"), Read(html), MediaTypeNames.Text.Html);

            Assert.AreElementsEqualIgnoringOrder(new[] { expected }, links.Select(l => l.ToString()));
        }