public void AddConnection() { var buffer = new BufferPool(128); buffer.AutoSizeFactor = 2; buffer.AutoSizeLimit = true; buffer.AddConnection(); Assert.AreEqual(2, buffer.Limit); }
public void AddConnectionNoAutosizing() { var buffer = new BufferPool(128); buffer.AutoSizeFactor = 2; buffer.AutoSizeLimit = false; buffer.AddConnection(); Assert.AreEqual(0, buffer.Limit); }
public void PushBufferDestroys() { var buffer = new BufferPool(128) { AutoSizeLimit = true, AutoSizeFactor = 1 }; buffer.AddConnection(); SocketAsyncEventArgs e; buffer.TryGetBuffer(out e); buffer.RemoveConnection(); buffer.PushBuffer(e); Assert.That(() => e.SetBuffer(0, 128), Throws.TypeOf <ObjectDisposedException>()); }