コード例 #1
0
        public void PoolCanGetMoreReadersThanPoolSize()
        {
            NetworkReaderPool.Capacity = 5;

            const int testReaderCount = 10;

            PooledNetworkReader[] Readers = new PooledNetworkReader[testReaderCount];

            for (int i = 0; i < testReaderCount; i++)
            {
                Readers[i] = NetworkReaderPool.GetReader(default(ArraySegment <byte>));
            }

            // Make sure all Readers are different
            Assert.That(Readers.Distinct().Count(), Is.EqualTo(testReaderCount));
        }