Exemple #1
0
        public void Can_Roundtrip_Deserialize(object value)
        {
            var source         = JustSerialize(value, out var flag).AsMemory();
            var roundtripValue = new BinaryItemFormatter().Deserialize(source, flag);

            Assert.Equal(value, roundtripValue);
        }
Exemple #2
0
        private byte[] JustSerialize(object value, out uint flag)
        {
            using var builder = new SequenceBuilder(MemoryPool <byte> .Shared);
            var t = new BinaryItemFormatter();

            flag = t.Serialize(builder, value);

            return(builder.Commit().ToArray());
        }