Пример #1
0
        public async Task TestCriticalURIs2()
        {
            ReadOptions options;

            Article result = await reader.Read(new Uri("https://medium.com/best-thing-i-found-online-today/9e7455ca375b"));

            Assert.Contains("16. Be confident in how you ask", result.Content);

            result = await reader.Read(new Uri("http://www.dgtle.com/article-5682-1.html"));

            Assert.Contains("http://img.dgtle.com/forum/201402/13/162237x8oumb8i0i0y0087.jpeg!680px", result.Content);

            result = await reader.Read(new Uri("http://m.spiegel.de/spiegelgeschichte/a-946060.html"));

            Assert.DoesNotContain("Detecting browser settings", result.Content);

            result = await reader.Read(new Uri("https://vimeo.com/84391640"));

            Assert.Contains("twitter.com/pokiapp", result.Content);

            result = await reader.Read(new Uri("http://www.youtube.com/watch?v=GI2lHSPkW1c"));

            Assert.Contains("IT PAST MIDNIGHT A COUPLE HOURS AGO, IT'S FEELS COLDER", result.Content);

            result = await reader.Read(new Uri("http://www.jn.pt/PaginaInicial/Politica/Interior.aspx?content_id=3996648&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+JN-ULTIMAS+%28JN+-+Ultimas%29"));

            Assert.DoesNotContain("Alberto João Jardim", result.Content);

            options = ReadOptions.CreateDefault();
            options.PreferHTMLEncoding = false;
            result = await reader.Read(new Uri("http://www.jn.pt/PaginaInicial/Politica/Interior.aspx?content_id=3996648&utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+JN-ULTIMAS+%28JN+-+Ultimas%29"), options);

            Assert.Contains("Alberto João Jardim", result.Content);
        }
Пример #2
0
        public async Task ReadArticleWithImagePlaceholdersTest()
        {
            ReadOptions options = ReadOptions.CreateDefault();

            options.ReplaceImagesWithPlaceholders = true;
            Article result = await reader.Read(new Uri("https://hacks.mozilla.org/2013/12/application-layout-with-css3-flexible-box-module/"), options);

            List <ArticleImage> images = result.Images.ToList();

            Assert.True(images.Count >= 3);
            Assert.True(images[0].Uri.ToString().StartsWith("https://hacks.mozilla.org"));
            Assert.True(images[1].Uri.ToString().EndsWith(".gif"));

            Assert.Contains("<!--IMG_1-->", result.Content);
            Assert.DoesNotContain("<img ", result.Content);
        }