public void TestDoublePropertyConversion()
{
ActiveMQMessage msg = new ActiveMQMessage();
String propertyName = "property";
Double doubleValue = 1.5;
msg.Properties.SetDouble(propertyName, doubleValue);
Assert.AreEqual((double)msg.Properties[propertyName], doubleValue, 0);
Assert.AreEqual(msg.Properties.GetDouble(propertyName), doubleValue, 0);
Assert.AreEqual(msg.Properties.GetString(propertyName), doubleValue.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)
{
}
try
{
msg.Properties.GetFloat(propertyName);
Assert.Fail("Should have thrown exception");
}
catch(MessageFormatException)
{
}
}