public void TestCreateWithPopulatedMap()
        {
            global::Amqp.Message message = new global::Amqp.Message
            {
                BodySection = new AmqpValue
                {
                    Value = new Map
                    {
                        { "entry1", true },
                        { "entry2", false }
                    }
                }
            };

            AmqpNmsMapMessageFacade facade = CreateReceivedMapMessageFacade(message);

            // Data should be preserved
            Assert.True(facade.Map.Keys.Count > 0);
            bool result = facade.Map.GetBool("entry1");

            Assert.True(result);
            Assert.True(facade.HasBody());

            // Should be able to use the message, e.g clearing it and adding to it.
            facade.ClearBody();
            Assert.False(facade.HasBody());
            facade.Map.SetString("entry", "value");
        }
        public void TestMessageClearBodyWorks()
        {
            AmqpNmsMapMessageFacade facade = CreateNewMapMessageFacade();

            CollectionAssert.IsEmpty(facade.Map.Keys);
            facade.Map.SetString("entry1", "value1");
            CollectionAssert.IsNotEmpty(facade.Map.Keys);
            facade.ClearBody();
            CollectionAssert.IsEmpty(facade.Map.Keys);
        }
        public void TestCreateWithNullBodySection()
        {
            global::Amqp.Message message = new global::Amqp.Message
            {
                BodySection = null
            };

            AmqpNmsMapMessageFacade facade = CreateReceivedMapMessageFacade(message);

            // Should be able to use the message, e.g clearing it and adding to it.
            facade.ClearBody();
            facade.Map.SetString("entry", "value");
            CollectionAssert.IsNotEmpty(facade.Map.Keys);
        }
        public void TestCreateWithEmptyMap()
        {
            global::Amqp.Message message = new global::Amqp.Message
            {
                BodySection = new AmqpValue {
                    Value = new Map()
                }
            };

            AmqpNmsMapMessageFacade facade = CreateReceivedMapMessageFacade(message);

            // Should be able to use the message, e.g clearing it and adding to it.
            facade.ClearBody();
            facade.Map.SetString("entry1", "value1");
        }
        public void TestNewMessageToSendClearBodyDoesNotFail()
        {
            AmqpNmsMapMessageFacade facade = CreateNewMapMessageFacade();

            facade.ClearBody();
        }