Пример #1
0
        [Test, Explicit] // tests #16
        public void CorrectlyFetchesUnicodeAndHtmlEscapedCharacters()
        {
            var titleParser = new HtmlTitleParser(new WebClient());
            var title       = titleParser.GetHtmlTitle("https://twitter.com/SlackHQ/status/570695657561858048");

            StringAssert.DoesNotContain(""", title);
            StringAssert.DoesNotContain("ðŸ“", title);
        }
Пример #2
0
        public void DoesntThrowExceptionOnBadUrl()
        {
            var throwsException = new Mock <IWebClient>();

            throwsException.Setup(x => x.DownloadString(It.IsAny <string>(), It.IsAny <IEnumerable <string> >())).ThrowsAsync(new Exception());
            var titleParser = new HtmlTitleParser(throwsException.Object);

            Assert.AreEqual(null, titleParser.GetHtmlTitle("foo://bar.baz"));
        }
Пример #3
0
        public void CanFetchTitleForExampleDotCom()
        {
            var titleParser = new HtmlTitleParser(new WebClient());

            Assert.AreEqual("Example Domain", titleParser.GetHtmlTitle("http://example.com"));
        }