public void TestReadBytes()
{
ActiveMQStreamMessage msg = new ActiveMQStreamMessage();
byte[] test = new byte[50];
for(int i = 0; i < test.Length; i++)
{
test[i] = (byte)i;
}
msg.WriteBytes(test);
msg.Reset();
byte[] valid = new byte[test.Length];
msg.ReadBytes(valid);
for(int i = 0; i < valid.Length; i++)
{
Assert.IsTrue(valid[i] == test[i]);
}
msg.Reset();
try
{
msg.ReadByte();
Assert.Fail("Should have thrown exception");
}
catch(MessageFormatException)
{
}
msg.Reset();
try
{
msg.ReadInt16();
Assert.Fail("Should have thrown exception");
}
catch(MessageFormatException)
{
}
msg.Reset();
try
{
msg.ReadInt32();
Assert.Fail("Should have thrown exception");
}
catch(MessageFormatException)
{
}
msg.Reset();
try
{
msg.ReadInt64();
Assert.Fail("Should have thrown exception");
}
catch(MessageFormatException)
{
}
msg.Reset();
try
{
msg.ReadSingle();
Assert.Fail("Should have thrown exception");
}
catch(MessageFormatException)
{
}
msg.Reset();
try
{
msg.ReadChar();
Assert.Fail("Should have thrown exception");
}
catch(MessageFormatException)
{
}
msg.Reset();
try
{
msg.ReadString();
Assert.Fail("Should have thrown exception");
}
catch(MessageFormatException)
{
}
}