public void TestXmlEntityBasicEscaping() { Assert.AreEqual(string.Empty, InstanceXml.TestXmlEscapeString(null)); Assert.AreEqual(string.Empty, InstanceXml.TestXmlEscapeString(string.Empty)); Assert.AreEqual("the 123,4567,890 jumpy foxes lazed over the quick brown dog", InstanceXml.TestXmlEscapeString("the 123,4567,890 jumpy foxes lazed over the quick brown dog")); Assert.AreEqual("&amp;"<'>", InstanceXml.TestXmlEscapeString("&\"<'>")); Assert.AreEqual("<a href="http://garba/">tom&jerry's</a>", InstanceXml.TestXmlEscapeString("<a href=\"http://garba/\">tom&jerry's</a>")); }
private static void ValidateRoundtripUnescapeEscape(string data) { string unescaped = InstanceXml.TestXmlUnescapeString(data); string escaped = InstanceXml.TestXmlEscapeString(unescaped); Assert.AreEqual(escaped, data); Trace.WriteLine("Success - Unescaped string was " + unescaped); }