Exemple #1
0
        public void RemoveEventAttributesTest()
        {
            string content = LoadHtmlFromResource("basicWithEvents.html");

            string safeHtml = HtmlSanitizer.GetSafeHtml(content);

            Console.WriteLine(safeHtml);

            Assert.IsFalse(safeHtml.IndexOf("onclick") >= 0);
        }
Exemple #2
0
        public void RemoveScriptTagTest()
        {
            string content = LoadHtmlFromResource("basicWithScript.html");

            string safeHtml = HtmlSanitizer.GetSafeHtml(content);

            Console.WriteLine(safeHtml);

            Assert.IsFalse(safeHtml.IndexOf("script") >= 0);
        }
Exemple #3
0
        public void RemoveFragmentStyleJavaScriptAttributesTest()
        {
            string content = LoadHtmlFromResource("basicFragment.html");

            string safeHtml = HtmlSanitizer.GetSafeHtml(content);

            Console.WriteLine(safeHtml);

            Assert.IsFalse(safeHtml.IndexOf("javascript:") >= 0);
            Assert.IsFalse(safeHtml.IndexOf("vbscript:") >= 0);
            Assert.IsFalse(safeHtml.IndexOf("expression:") >= 0);
        }