public void return_to_pool_directly() { var sut = new BufferSlicePool(10, 2); var buffer = sut.Pop(); sut.Push(buffer); sut.Pop(); sut.Pop(); }
public void return_to_pool__verify_that_it_got_enqueued() { var sut = new BufferSlicePool(10, 2); var buffer = sut.Pop(); sut.Push(buffer); sut.Pop(); sut.Pop(); }
public void pop_too_many() { var sut = new BufferSlicePool(10, 2); sut.Pop(); sut.Pop(); Action actual = () => sut.Pop(); actual.ShouldThrow<PoolEmptyException>(); }
public void pop_one() { var sut = new BufferSlicePool(10, 2); var actual = sut.Pop(); actual.Capacity.Should().Be(10); actual.Offset.Should().Be(10, "internal implementation is a stack, last buffer is at pos 10"); }