Пример #1
0
        public void RandomValueInt32ArrayTests(int length)
        {
            var array = new Int32[length];
            var r     = new Random();

            r.NextBytes(MemoryMarshal.AsBytes(array.AsSpan()));

            var encoded = MessagePackSerializer.Serialize(array, options);

            Assert.IsNotNull(encoded);
            var decoded = MessagePackSerializer.Deserialize <Int32[]>(encoded, options);

            Assert.IsNotNull(decoded);
            Assert.AreEqual(length, decoded.Length);
            for (var index = 0; index < array.Length; index++)
            {
                Assert.AreEqual(array[index], decoded[index]);
            }
        }
Пример #2
0
 public IKzWriter Add(Int32 v)
 {
     v.AsSpan().CopyTo(Memory.Span.Slice(Length)); Length += 4; return(this);
 }