public void TestBytes() { var stream = new MsgPackStream(); var bytes = new BufferSegment(new byte[] { 1, 12, 23, 34, 45, 56 }); stream.WriteBytes(bytes); Assert.AreEqual(stream.Position, bytes.Length); stream.Position = 0; Assert.True( BufferSegment.EqualityComparer.Equals( bytes, stream.ReadBytes(unchecked ((uint)bytes.Length)) ) ); }