public void BufferUnderMaxSizeIsNotDisposed() { var buffer = new StringBuffer(); buffer.EnsureCharCapacity(10); var cache = new StringBufferCache(1, buffer.CharCapacity); cache.Release(buffer); buffer.ByteCapacity.Should().NotBe(0); buffer.CharCapacity.Should().NotBe(0); }
public void BufferOverMaxSizeIsDisposed() { var cache = new StringBufferCache(1, 10); var buffer = cache.Acquire(); buffer.EnsureCharCapacity(11); cache.Release(buffer); buffer.ByteCapacity.Should().Be(0); buffer.CharCapacity.Should().Be(0); buffer.Length.Should().Be(0); }