public virtual void TestQuoting() { Assert.Equal("ab<cd", HtmlQuoting.QuoteHtmlChars("ab<cd")); Assert.Equal("ab>", HtmlQuoting.QuoteHtmlChars("ab>")); Assert.Equal("&&&", HtmlQuoting.QuoteHtmlChars("&&&" )); Assert.Equal(" '\n", HtmlQuoting.QuoteHtmlChars(" '\n")); Assert.Equal(""", HtmlQuoting.QuoteHtmlChars("\"")); Assert.Equal(null, HtmlQuoting.QuoteHtmlChars(null)); }
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)); }
/// <exception cref="System.Exception"/> private void RunRoundTrip(string str) { Assert.Equal(str, HtmlQuoting.UnquoteHtmlChars(HtmlQuoting.QuoteHtmlChars (str))); }
/// <exception cref="System.IO.IOException"/> public override void Write(int b) { this.data[0] = unchecked ((byte)b); HtmlQuoting.QuoteHtmlChars(@out, this.data, 0, 1); }
/// <exception cref="System.IO.IOException"/> public override void Write(byte[] data, int off, int len) { HtmlQuoting.QuoteHtmlChars(@out, data, off, len); }