Пример #1
0
        public void SanitizeHtml_ExistingUrl_DoesNotContainHtmlTags()
        {
            // Arrange
            var htmlWeb  = new HtmlWeb();
            var document = htmlWeb.Load(@"https://en.wikipedia.org/wiki/Strategy_pattern");

            // Act
            var htmlSanitizer = new HtmlSanitizer();
            var cleanText     = htmlSanitizer.SanitizeHtmlDocument(document);

            // Assert
            cleanText.Should()
            .NotContain(@"<img")
            .And.NotContain(@"<div")
            .And.NotContain(@"<!DOCTYPE html>")
            .And.NotContain(@"document.documentElement.className");
        }