Ejemplo n.º 1
0
 public void TestEscapeUnicode()
 {
     Assert.AreEqual("English or \\u4E2D\\u6587 or a\\u0308 or \\uD834\\uDD60", "English or 中文 or \u0061\u0308 or \uD834\uDD60".EscapeUnicode());
     Assert.AreEqual("English or \\u4E2D\\u6587 or a\\u0308 or \\uD834\\uDD60", "English or 中文 or \u0061\u0308 or \U0001D160".EscapeUnicode());
     Assert.AreEqual("% a\\u0308 or \\uD834\\uDD60\\", "\x25 \u0061\u0308 or \uD834\uDD60\\".EscapeUnicode());
     Assert.AreEqual(null, StringExt.EscapeUnicode(null));
     Assert.AreEqual("", "".EscapeUnicode());
     Assert.AreEqual("\\", "\\".EscapeUnicode());
     Assert.AreEqual("\\\\", "\\\\".EscapeUnicode());
     Assert.AreEqual("\\\\u0001", "\\\x1".EscapeUnicode());
     Assert.AreEqual("\\\\\\", "\\\\\\".EscapeUnicode());
     Assert.AreEqual("\\\\\\u0001", "\\\\\x1".EscapeUnicode());
     Assert.AreEqual("\\ab", "\\ab".EscapeUnicode());
     Assert.AreEqual("\\a\\b\\u23556", "\\a\\b\u23556".EscapeUnicode());
     Assert.AreEqual("\\a\\b\\U23556", "\\a\\b\\U23556".EscapeUnicode());
 }