public void Test_Escape() { JID j = JID.Escape("d'artagnan", "gascon.fr", "elder"); Assert.AreEqual(@"d\[email protected]/elder", j.ToString()); j = JID.Escape("space cadet", "example.com", null); Assert.AreEqual(@"space\[email protected]", j.ToString()); j = JID.Escape("call me \"ishmael\"", "example.com", null); Assert.AreEqual(@"call\20me\20\22ishmael\[email protected]", j.ToString()); j = JID.Escape("at&t guy", "example.com", null); Assert.AreEqual(@"at\26t\[email protected]", j.ToString()); j = JID.Escape("/.fanboy", "example.com", null); Assert.AreEqual(@"\[email protected]", j.ToString()); j = JID.Escape("::foo::", "example.com", null); Assert.AreEqual(@"\3a\3afoo\3a\[email protected]", j.ToString()); j = JID.Escape("<foo>", "example.com", null); Assert.AreEqual(@"\3cfoo\[email protected]", j.ToString()); j = JID.Escape("user@host", "example.com", null); Assert.AreEqual(@"user\[email protected]", j.ToString()); j = JID.Escape(@"c:\net", "example.com", null); Assert.AreEqual(@"c\3a\[email protected]", j.ToString()); j = JID.Escape(@"c:\\net", "example.com", null); Assert.AreEqual(@"c\3a\5c\[email protected]", j.ToString()); j = JID.Escape(@"c:\cool stuff", "example.com", null); Assert.AreEqual(@"c\3a\5ccool\[email protected]", j.ToString()); j = JID.Escape(@"c:\5commas", "example.com", null); Assert.AreEqual(@"c\3a\[email protected]", j.ToString()); }