public void BOOLEAN_ReadWrite() { AMQType type = AMQType.BOOLEAN; ByteBuffer buffer = ByteBuffer.Allocate(0x1000); type.WriteToBuffer(true, buffer); buffer.Flip(); buffer.Rewind(); AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer); Assert.AreEqual(true, value.Value); }
public void VOID_ReadWrite() { AMQType type = AMQType.VOID; ByteBuffer buffer = ByteBuffer.Allocate(0x1000); type.WriteToBuffer(null, buffer); buffer.Flip(); buffer.Rewind(); AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer); Assert.AreEqual(null, value.Value); }
public void UINT32_ReadWrite() { AMQType type = AMQType.UINT32; ByteBuffer buffer = ByteBuffer.Allocate(0x1000); const uint VALUE = 0xFFEEDDCC; type.WriteToBuffer(VALUE, buffer); buffer.Flip(); buffer.Rewind(); AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer); Assert.AreEqual(VALUE, value.Value); }
public void LONG_STRING_ReadWrite() { AMQType type = AMQType.LONG_STRING; ByteBuffer buffer = ByteBuffer.Allocate(0x1000); const string VALUE = "simple string 1"; type.WriteToBuffer(VALUE, buffer); buffer.Flip(); buffer.Rewind(); AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer); Assert.AreEqual(VALUE, value.Value); }
public void DOUBLE_ReadWrite() { AMQType type = AMQType.DOUBLE; ByteBuffer buffer = ByteBuffer.Allocate(0x1000); const double VALUE = 1.2345000E-045; type.WriteToBuffer(VALUE, buffer); buffer.Flip(); buffer.Rewind(); AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer); Assert.AreEqual(VALUE, value.Value); }
public void FLOAT_ReadWrite() { AMQType type = AMQType.FLOAT; ByteBuffer buffer = ByteBuffer.Allocate(0x1000); const float VALUE = 1.2345000E-035f; type.WriteToBuffer(VALUE, buffer); buffer.Flip(); buffer.Rewind(); AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer); Assert.AreEqual(VALUE, value.Value); }
public void UINT64_ReadWrite() { AMQType type = AMQType.UINT64; ByteBuffer buffer = ByteBuffer.Allocate(0x1000); const ulong VALUE = (2 ^ 61 + 1233123); type.WriteToBuffer(VALUE, buffer); buffer.Flip(); buffer.Rewind(); AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer); Assert.AreEqual(VALUE, value.Value); }
public void INT16_ReadWrite() { AMQType type = AMQType.INT16; ByteBuffer buffer = ByteBuffer.Allocate(0x1000); const short VALUE = -32765; type.WriteToBuffer(VALUE, buffer); buffer.Flip(); buffer.Rewind(); AMQTypedValue value = AMQTypedValue.ReadFromBuffer(buffer); Assert.AreEqual(VALUE, value.Value); }