Пример #1
0
        public void AddConnection()
        {
            var buffer = new BufferPool(128);

            buffer.AutoSizeFactor = 2;
            buffer.AutoSizeLimit  = true;

            buffer.AddConnection();
            Assert.AreEqual(2, buffer.Limit);
        }
Пример #2
0
        public void AddConnectionNoAutosizing()
        {
            var buffer = new BufferPool(128);

            buffer.AutoSizeFactor = 2;
            buffer.AutoSizeLimit  = false;

            buffer.AddConnection();
            Assert.AreEqual(0, buffer.Limit);
        }
Пример #3
0
        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>());
        }