コード例 #1
0
        public void ShouldHandleClearAfterNoUsage()
        {
            var pool = new ParameterizedObjectPool <int, MyPooledObject>();

            pool.Clear();

            Assert.That(0, Is.EqualTo(pool.KeysInPoolCount));
        }
コード例 #2
0
        public void ShouldHandleClearAfterSomeUsage()
        {
            var pool = new ParameterizedObjectPool <int, MyPooledObject>();

            using (var obj = pool.GetObject(1))
            {
            }

            pool.Clear();

            Assert.That(0, Is.EqualTo(pool.KeysInPoolCount));
        }
コード例 #3
0
        public void ShouldHandleClearAndThenPoolCanBeUsedAgain()
        {
            var pool = new ParameterizedObjectPool <int, MyPooledObject>();

            using (var obj = pool.GetObject(1))
            {
            }

            pool.Clear();

            using (var obj = pool.GetObject(1))
            {
            }

            Assert.That(1, Is.EqualTo(pool.KeysInPoolCount));
        }
コード例 #4
0
        public void ShouldHandleClearAndThenPoolCanBeUsedAgain()
        {
            var pool = new ParameterizedObjectPool<int, MyPooledObject>();

            using (var obj = pool.GetObject(1))
            {
            }

            pool.Clear();

            using (var obj = pool.GetObject(1))
            {
            }

            Assert.That(1, Is.EqualTo(pool.KeysInPoolCount));
        }
コード例 #5
0
        public void ShouldHandleClearAfterSomeUsage()
        {
            var pool = new ParameterizedObjectPool<int, MyPooledObject>();

            using (var obj = pool.GetObject(1))
            {
            }

            pool.Clear();

            Assert.That(0, Is.EqualTo(pool.KeysInPoolCount));
        }
コード例 #6
0
        public void ShouldHandleClearAfterNoUsage()
        {
            var pool = new ParameterizedObjectPool<int, MyPooledObject>();

            pool.Clear();

            Assert.That(0, Is.EqualTo(pool.KeysInPoolCount));
        }