Пример #1
0
        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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }
Пример #6
0
        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);
        }
Пример #7
0
        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);
        }
Пример #8
0
        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);
        }