Beispiel #1
0
        public int WriteTo(byte[] buffer, int offset)
        {
            var dataOffset = offset + MsgSerializer.HeaderLength;
            var written    = 0;

            written += MsgSerializer.WriteUInt32(Frame, buffer, dataOffset);
            written += MsgSerializer.WriteUInt64(InputMask, buffer, dataOffset + written);
            written += MsgSerializer.WriteHeader(written, MsgId, buffer, offset);

            return(written);
        }
        public void ShouldSerializeAndDeserializeUInt64(ulong value)
        {
            var written = MsgSerializer.WriteUInt64(value, _buffer, 0);

            Assert.True(written == sizeof(ulong), $"Bad write size: {written}");

            var offset       = 0;
            var deserialized = MsgSerializer.ReadUInt64(_buffer, ref offset);

            Assert.True(offset == sizeof(ulong), $"Bad read size: {offset}");

            Assert.True(value == deserialized, $"Bad result: {deserialized}");
        }