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

TtestWriteOnlyBody() private method

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