Esempio n. 1
0
        public void TestScriptTagInWhiteList()
        {
            Whitelist whitelist = Whitelist.Relaxed;

            whitelist.AddTags("script");
            Assert.IsTrue(Dcsoup.IsValid("Hello<script>alert('Doh')</script>World !", whitelist));
        }
Esempio n. 2
0
        public void TestIsValid()
        {
            string ok   = "<p>Test <b><a href='http://example.com/'>OK</a></b></p>";
            string nok1 = "<p><script></script>Not <b>OK</b></p>";
            string nok2 = "<p align=right>Test Not <b>OK</b></p>";
            string nok3 = "<!-- comment --><p>Not OK</p>"; // comments and the like will be cleaned

            Assert.IsTrue(Dcsoup.IsValid(ok, Whitelist.Basic));
            Assert.IsFalse(Dcsoup.IsValid(nok1, Whitelist.Basic));
            Assert.IsFalse(Dcsoup.IsValid(nok2, Whitelist.Basic));
            Assert.IsFalse(Dcsoup.IsValid(nok3, Whitelist.Basic));
        }