Exemplo n.º 1
0
        public void RichTextTagsAreMarkedAsReadOnly()
        {
            var message = Message.CreateMessage("Hello <color=red>World</color>");

            m_Method.Transform(message);

            Assert.AreEqual(4, message.Fragments.Count, "Expected 3 fragments");
            Assert.AreEqual("Hello ", message.Fragments[0].ToString(), "Expected Fragment 0 to match");
            Assert.AreEqual(typeof(WritableMessageFragment), message.Fragments[0].GetType(), "Expected fragment 0 to be writable");

            Assert.AreEqual("<color=red>", message.Fragments[1].ToString(), "Expected Fragment 1 to match");
            Assert.AreEqual(typeof(ReadOnlyMessageFragment), message.Fragments[1].GetType(), "Expected fragment 1 to be readonly");

            Assert.AreEqual("World", message.Fragments[2].ToString(), "Expected Fragment 2 to match");
            Assert.AreEqual(typeof(WritableMessageFragment), message.Fragments[2].GetType(), "Expected fragment 2 to be writable");

            Assert.AreEqual("</color>", message.Fragments[3].ToString(), "Expected Fragment 3 to match");
            Assert.AreEqual(typeof(ReadOnlyMessageFragment), message.Fragments[3].GetType(), "Expected fragment 3 to be readonly");
            message.Release();
        }