Exemple #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));
 }
Exemple #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));
 }
Exemple #3
0
 /// <exception cref="System.Exception"/>
 private void RunRoundTrip(string str)
 {
     Assert.Equal(str, HtmlQuoting.UnquoteHtmlChars(HtmlQuoting.QuoteHtmlChars
                                                        (str)));
 }
Exemple #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);
 }
Exemple #5
0
 /// <exception cref="System.IO.IOException"/>
 public override void Write(byte[] data, int off, int len)
 {
     HtmlQuoting.QuoteHtmlChars(@out, data, off, len);
 }