public void TestWriteTo() { var backingBytes = new byte[100]; using (var buffer = new ByteArrayBuffer(backingBytes, 0, 0, false)) { buffer.WriteBytes(new[] { (byte)1, (byte)2 }); using (var memoryStream = new MemoryStream()) { buffer.WriteTo(memoryStream); Assert.AreEqual(2, memoryStream.Length); } } }