Apache.NMS.ActiveMQ.Test.Commands.ActiveMQMessageTest.TestBooleanPropertyConversion C# (CSharp) Method

TestBooleanPropertyConversion() private method

private TestBooleanPropertyConversion ( ) : void
return void
        public void TestBooleanPropertyConversion()
        {
            ActiveMQMessage msg = new ActiveMQMessage();
            String propertyName = "property";
            msg.Properties.SetBool(propertyName, true);

            Assert.AreEqual((bool)msg.Properties[propertyName], true);
            Assert.IsTrue(msg.Properties.GetBool(propertyName));
            Assert.AreEqual(msg.Properties.GetString(propertyName), "True");
            try
            {
                msg.Properties.GetByte(propertyName);
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            try
            {
                msg.Properties.GetShort(propertyName);
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            try
            {
                msg.Properties.GetInt(propertyName);
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            try
            {
                msg.Properties.GetLong(propertyName);
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            try
            {
                msg.Properties.GetFloat(propertyName);
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

            try
            {
                msg.Properties.GetDouble(propertyName);
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }
        }