Пример #1
0
 public void TestXmlEntityBasicUnescaping()
 {
     Assert.AreEqual(string.Empty, InstanceXml.TestXmlUnescapeString(null));
     Assert.AreEqual(string.Empty, InstanceXml.TestXmlUnescapeString(string.Empty));
     Assert.AreEqual("the 123,4567,890 jumpy foxes lazed over the quick brown dog", InstanceXml.TestXmlUnescapeString("the 123,4567,890 jumpy foxes lazed over the quick brown dog"));
     Assert.AreEqual("&amp;\"<'>", InstanceXml.TestXmlUnescapeString("&amp;amp;&quot;&lt;&apos;&gt;"));
     Assert.AreEqual("<a href=\"http://garba/\">tom&jerry's</a>", InstanceXml.TestXmlUnescapeString("&lt;a href=&quot;http://garba/&quot;&gt;tom&amp;jerry&apos;s&lt;/a&gt;"));
 }
Пример #2
0
        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);
        }
Пример #3
0
 public void TestXmlEntityUnescapingSpecialFormattedEntities()
 {
     // these all say the same thing
     Assert.AreEqual("\u001B", InstanceXml.TestXmlUnescapeString("&#27;"));
     Assert.AreEqual("\u001B", InstanceXml.TestXmlUnescapeString("&#x1B;"));
     Assert.AreEqual("\u001B", InstanceXml.TestXmlUnescapeString("&#X1B;"));
     Assert.AreEqual("\u001B", InstanceXml.TestXmlUnescapeString("&#x1b;"));
     Assert.AreEqual("\u001B", InstanceXml.TestXmlUnescapeString("&#X1B;"));
     Assert.AreEqual("\u001B", InstanceXml.TestXmlUnescapeString("&#x01B;"));
     Assert.AreEqual("\u001B", InstanceXml.TestXmlUnescapeString("&#x001B;"));
     Assert.AreEqual("\u001B", InstanceXml.TestXmlUnescapeString("&#x0001B;"));
     Assert.AreEqual("\u001B", InstanceXml.TestXmlUnescapeString("&#x00001B;"));
 }