public void TestReceivedObjectMessageThrowsMessageNotWriteableExceptionOnSetObject()
        {
            string content = "myStringContent";
            NmsTestObjectMessageFacade facade = new NmsTestObjectMessageFacade();

            facade.Body = content;
            NmsObjectMessage objectMessage = new NmsObjectMessage(facade);

            objectMessage.OnDispatch();

            Assert.Throws <MessageNotWriteableException>(() => objectMessage.Body = "newObject");
        }
        public void TestClearBodyOnReceivedObjectMessageMakesMessageWritable()
        {
            string content = "myStringContent";
            NmsTestObjectMessageFacade facade = new NmsTestObjectMessageFacade();

            facade.Body = content;
            NmsObjectMessage objectMessage = new NmsObjectMessage(facade);

            objectMessage.OnDispatch();

            Assert.True(objectMessage.IsReadOnlyBody);
            objectMessage.ClearBody();
            Assert.False(objectMessage.IsReadOnlyBody);
        }
        public void TestClearBodyOnReceivedObjectMessageClearsUnderlyingMessageBody()
        {
            string content = "myStringContent";
            NmsTestObjectMessageFacade facade = new NmsTestObjectMessageFacade();

            facade.Body = content;
            NmsObjectMessage objectMessage = new NmsObjectMessage(facade);

            objectMessage.OnDispatch();

            Assert.NotNull(objectMessage.Body);
            objectMessage.ClearBody();

            Assert.Null(facade.Body);
        }