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

TestLongPropertyConversion() private method

private TestLongPropertyConversion ( ) : void
return void
        public void TestLongPropertyConversion()
        {
            ActiveMQMessage msg = new ActiveMQMessage();
            String propertyName = "property";
            msg.Properties.SetLong(propertyName, 1);

            Assert.AreEqual((long)msg.Properties[propertyName], 1);
            Assert.AreEqual(msg.Properties.GetLong(propertyName), 1);
            Assert.AreEqual(msg.Properties.GetString(propertyName), "1");

            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.GetFloat(propertyName);
                Assert.Fail("Should have thrown exception");
            }
            catch(MessageFormatException)
            {
            }

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