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

TestFloatPropertyConversion() private method

private TestFloatPropertyConversion ( ) : void
return void
        public void TestFloatPropertyConversion()
        {
            ActiveMQMessage msg = new ActiveMQMessage();
            String propertyName = "property";
            float floatValue = (float)1.5;
            msg.Properties.SetFloat(propertyName, floatValue);
            Assert.AreEqual((float)msg.Properties[propertyName], floatValue, 0);
            Assert.AreEqual(msg.Properties.GetFloat(propertyName), floatValue, 0);
            Assert.AreEqual(msg.Properties.GetDouble(propertyName), floatValue, 0);
            Assert.AreEqual(msg.Properties.GetString(propertyName), floatValue.ToString());

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

            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)
            {
            }
        }