public void ConvertToMqMessage_CorrectBytesMessage_CorrectResult()
        {
            var message = new BytesMessage
            {
                Body          = new byte[] { 97, 98, 99 },
                MessageId     = "abc",
                CorrelationId = "def",
                LifeTime      = TimeSpan.FromMinutes(10),
                ReplyQueue    = "Reply",
                Properties    = { { "Prop1", 12 }, { "Prop2", "def" } }
            };
            var session = Given.Session.Please();

            var result = message.ConvertToMqMessage(session);

            Assert.Multiple(() =>
            {
                Assert.IsInstanceOf <IBytesMessage>(result);
                var bytesMessage = (IBytesMessage)result;
                Assert.AreEqual(message.Body.Length, bytesMessage.BodyLength);
                var bytes = new byte[message.Body.Length];
                bytesMessage.ReadBytes(bytes);
                CollectionAssert.AreEqual(message.Body, bytes);
                Assert.AreEqual("abc", bytesMessage.JMSMessageID);
                Assert.AreEqual(10 * 60 * 1000, bytesMessage.JMSExpiration);
                Assert.AreEqual("def", bytesMessage.JMSCorrelationID);
                Assert.AreEqual(message.ReplyQueue, bytesMessage.JMSReplyTo.Name);
                CollectionAssert.AreEquivalent(message.Properties, bytesMessage.GetProperties());
            });
        }
        public void ConvertToMqMessage_CorrectBytesMessage_CorrectResult()
        {
            var message = new BytesMessage
            {
                Body          = new byte[] { 97, 98, 99 },
                MessageId     = "abc",
                CorrelationId = "def",
                LifeTime      = TimeSpan.FromMinutes(10),
                ReplyQueue    = "Reply",
                Properties    = { { "Prop1", 12 }, { "Prop2", "def" } }
            };
            var session = Given.Session.Please();

            var result = message.ConvertToMqMessage(session);

            Assert.Multiple(() =>
            {
                Assert.IsInstanceOf <IBytesMessage>(result, nameof(IBytesMessage));
                var bytesMessage = (IBytesMessage)result;
                Assert.AreEqual(message.Body.Length, bytesMessage.BodyLength, nameof(bytesMessage.BodyLength));
                var bytes = new byte[message.Body.Length];
                bytesMessage.ReadBytes(bytes);
                CollectionAssert.AreEqual(message.Body, bytes, nameof(message.Body));
                Assert.AreEqual("abc", bytesMessage.NMSMessageId, nameof(bytesMessage.NMSMessageId));
                Assert.AreEqual(TimeSpan.FromMinutes(10), bytesMessage.NMSTimeToLive, nameof(bytesMessage.NMSTimeToLive));
                Assert.AreEqual("def", bytesMessage.NMSCorrelationID, nameof(bytesMessage.NMSCorrelationID));
            });
        }