示例#1
0
 public virtual void TestQuoting()
 {
     Assert.Equal("ab&lt;cd", HtmlQuoting.QuoteHtmlChars("ab<cd"));
     Assert.Equal("ab&gt;", HtmlQuoting.QuoteHtmlChars("ab>"));
     Assert.Equal("&amp;&amp;&amp;", HtmlQuoting.QuoteHtmlChars("&&&"
                                                                ));
     Assert.Equal(" &apos;\n", HtmlQuoting.QuoteHtmlChars(" '\n"));
     Assert.Equal("&quot;", HtmlQuoting.QuoteHtmlChars("\""));
     Assert.Equal(null, HtmlQuoting.QuoteHtmlChars(null));
 }
示例#2
0
 public virtual void TestNeedsQuoting()
 {
     Assert.True(HtmlQuoting.NeedsQuoting("abcde>"));
     Assert.True(HtmlQuoting.NeedsQuoting("<abcde"));
     Assert.True(HtmlQuoting.NeedsQuoting("abc'de"));
     Assert.True(HtmlQuoting.NeedsQuoting("abcde\""));
     Assert.True(HtmlQuoting.NeedsQuoting("&"));
     NUnit.Framework.Assert.IsFalse(HtmlQuoting.NeedsQuoting(string.Empty));
     NUnit.Framework.Assert.IsFalse(HtmlQuoting.NeedsQuoting("ab\ncdef"));
     NUnit.Framework.Assert.IsFalse(HtmlQuoting.NeedsQuoting(null));
 }
示例#3
0
 /// <exception cref="System.Exception"/>
 private void RunRoundTrip(string str)
 {
     Assert.Equal(str, HtmlQuoting.UnquoteHtmlChars(HtmlQuoting.QuoteHtmlChars
                                                        (str)));
 }
示例#4
0
 /// <exception cref="System.IO.IOException"/>
 public override void Write(int b)
 {
     this.data[0] = unchecked ((byte)b);
     HtmlQuoting.QuoteHtmlChars(@out, this.data, 0, 1);
 }
示例#5
0
 /// <exception cref="System.IO.IOException"/>
 public override void Write(byte[] data, int off, int len)
 {
     HtmlQuoting.QuoteHtmlChars(@out, data, off, len);
 }