Exemple #1
0
        void ChopTrimPart(IMessagePart part)
        {
            var bytes0 = Guid.NewGuid().ToByteArray();
            var int0   = (uint)Util.rng.Next(1000, 1000000);
            var int1   = (uint)Util.rng.Next(1000, 1000000);

            part.Append(bytes0);

            part.Insert(int0);
            part.Insert(int0);
            part.Trim((UIntPtr)4);
            part.Trim(out var trim);
            Assert.Equal(int0, trim);
            Assert.True(Util.BytesEqual(bytes0, part.Raw));

            part.Append(int1);
            part.Append(int1);
            part.Chop((UIntPtr)4);
            part.Chop(out var chop);
            Assert.Equal(int1, chop);
            Assert.True(Util.BytesEqual(bytes0, part.Raw));
        }
Exemple #2
0
 public override void Write(ReadOnlySpan <byte> buffer)
 {
     part.Append(buffer);
 }