Example #1
0
 [Test] public void Test_Create()
 {
     Message msg = new Message(doc);
     msg.Html = "foo";
     Assert.AreEqual("<message id=\""+msg.ID+"\"><html xmlns=\"http://kixeye.jabber.org/protocol/xhtml-im\"><body xmlns=\"http://www.w3.org/1999/xhtml\">foo</body></html><body>foo</body></message>", msg.ToString());
     // TODO: deal with the namespace problem here
     msg.Html = "f<a href=\"http://www.kixeye.jabber.org\">o</a>o";
     Assert.AreEqual("<message id=\""+msg.ID+"\"><html xmlns=\"http://kixeye.jabber.org/protocol/xhtml-im\"><body xmlns=\"http://www.w3.org/1999/xhtml\">f<a href=\"http://www.kixeye.jabber.org\">o</a>o</body></html><body>foo</body></message>", msg.ToString());
     Assert.AreEqual("f<a href=\"http://www.kixeye.jabber.org\">o</a>o", msg.Html);
 }
Example #2
0
 [Test] public void Test_Escape()
 {
     Message msg = new Message(doc);
     msg.Body = "&";
     Assert.AreEqual("<message id=\""+msg.ID+"\"><body>&amp;</body></message>", msg.ToString());
     msg.RemoveChild(msg["body"]);
     Assert.AreEqual("<message id=\""+msg.ID+"\"></message>", msg.ToString());
     try
     {
         msg.Html = "&";
         Assert.Fail("should have thrown an exception");
     }
     catch
     {
         Assert.IsTrue(true, "Threw exception, as expected");
     }
 }