private static NodeMessage ConvertToBrokeredMessageAndBack(NodeMessage nodeMessage)
        {
            var target          = new MessageConverter();
            var brokeredMessage = target.ConvertToBrokeredMessage(nodeMessage);

            Assert.IsNotNull(brokeredMessage);

            var result = target.ConvertToNodeMessage(brokeredMessage);

            Assert.IsNotNull(result);
            Assert.AreNotSame(nodeMessage, result);
            Assert.AreEqual(nodeMessage.MessageType, result.MessageType);
            Assert.AreEqual(nodeMessage.SenderNodeId, result.SenderNodeId);
            Assert.AreEqual(nodeMessage.RecipientNodeId, result.RecipientNodeId);

            if (nodeMessage.Data == null)
            {
                Assert.IsNull(result.Data);
            }
            else
            {
                Assert.IsNotNull(result.Data);
                Assert.AreEqual(nodeMessage.Data.GetType(), result.Data.GetType());
            }

            return(result);
        }
        public void ConvertToBrokeredMessage_Null_ArgumentNullException()
        {
            var target = new MessageConverter();

            Assert.ThrowsException <ArgumentNullException>(() => target.ConvertToBrokeredMessage(null));
        }