public void Append(byte[] buffer) { Guard.NotNull(buffer, "buffer"); EnsureCapacity(buffer.Length); Buffer.BlockCopy(buffer, 0, _buffer, _count, buffer.Length); _count += buffer.Length; }
public void append_doubles_capacity_until_it_can_satisfy_the_buffer() { var buffer = new ByteBuffer(1); buffer.Append(new byte[1]); Assert.Equal(1, buffer.Capacity); buffer.Append(new byte[1]); Assert.Equal(2, buffer.Capacity); buffer.Append(new byte[10]); Assert.Equal(16, buffer.Capacity); }