public void TestS32PacketBE2()
        {
            S32Packet v1 = new S32Packet(0xABA);
            int bufferSize = sizeof(int) + CDRHeaderSize;
            var buffer = ByteBufferAllocator.Instance.Allocate(bufferSize);
            CDREncapsulation.Serialize(buffer, v1, ByteOrder.BigEndian);
            Assert.AreEqual(bufferSize, buffer.Position);

            buffer.Rewind();
            Assert.AreEqual("00 00 00 00 00 00 0A BA", buffer.GetHexDump());
            S32Packet v2 = CDREncapsulation.Deserialize<S32Packet>(buffer);
            Assert.AreEqual(v1, v2);
            Assert.AreEqual(bufferSize, buffer.Position);
        }
Example #2
0
        public void TestS32Packet()
        {
            S32Packet v1 = new S32Packet(0xABA);
            var buffer = ByteBufferAllocator.Instance.Allocate(sizeof(int));
            Serializer.Serialize(buffer, v1);
            Assert.AreEqual(sizeof(int), buffer.Position);

            buffer.Rewind();
            S32Packet v2 = Serializer.Deserialize<S32Packet>(buffer);
            Assert.AreEqual(v1, v2);
            Assert.AreEqual(sizeof(int), buffer.Position);
        }