Apache.NMS.ActiveMQ.Test.Commands.ActiveMQTextMessageTest.TestReadOnlyBody C# (CSharp) Method

TestReadOnlyBody() private method

private TestReadOnlyBody ( ) : void
return void
        public void TestReadOnlyBody()
        {
            ActiveMQTextMessage textMessage = new ActiveMQTextMessage();
            textMessage.Text = "test";
            textMessage.ReadOnlyBody = true;
            try
            {
                Assert.IsTrue(textMessage.Text.Length > 0);
            }
            catch(MessageNotReadableException)
            {
                Assert.Fail("should be readable");
            }
            try
            {
                textMessage.Text = "test";
                Assert.Fail("should throw exception");
            }
            catch(MessageNotWriteableException)
            {
            }
        }