public void TestPersistence(int capacity, bool cleanOnReturn, int size) { var configuration = new BufferPoolConfiguration { Capacity = capacity, CleanOnReturn = cleanOnReturn, Size = size }; Assert.IsTrue(configuration.Capacity == capacity, "Capacity is not expected value"); Assert.IsTrue(configuration.CleanOnReturn == cleanOnReturn, "Clean on return is not expected value"); Assert.IsTrue(configuration.Size == size, "Size is not expected value"); }
public void BufferCreationSuccess(int size, int capacity, bool cleanOnReturn) { var configuration = new BufferPoolConfiguration { Capacity = capacity, Size = size, CleanOnReturn = cleanOnReturn }; var pool = new BufferPool(configuration); var buffer = pool.Take(); var bufferSize = buffer.Length; var returnResult = pool.Return(buffer); Assert.IsTrue(bufferSize == size, "Buffer size of retrieved array is not expected"); Assert.IsTrue(returnResult, "Return result was expected to be true"); Assert.IsTrue(pool.ClearOnReturn == cleanOnReturn, "Clean on return does not match expected value"); Assert.IsTrue(pool.BufferSize == size, "Size does not match expected value"); }