public void ShouldStopWaitingAndReturnFalseWhenTryAcquireTimesOut()
        {
            Mock <IPooledObjectFactory <NonShareable> > mockPooledObjectFactory = new Mock <IPooledObjectFactory <NonShareable> >();

            mockPooledObjectFactory.Setup(x => x.Create()).Returns(() => new NonShareable());

            var pool = new PoolBuilder <NonShareable>()
                       .InitialSize(0)
                       .MaxSize(1)
                       .WithFactory(mockPooledObjectFactory.Object)
                       .Instance();

            var          acquired = pool.Acquire();
            NonShareable acquiredObjectInTry;

            Assert.Equal(false, pool.TryAcquire(100, out acquiredObjectInTry));

            pool.Dispose();
        }
        public void ShouldReturnTrueAndAcquiredObjectOnTryAcquireWithAvailableObjects()
        {
            Mock <IPooledObjectFactory <NonShareable> > mockPooledObjectFactory = new Mock <IPooledObjectFactory <NonShareable> >();

            mockPooledObjectFactory.Setup(x => x.Create()).Returns(() => new NonShareable());

            var pool = new PoolBuilder <NonShareable>()
                       .InitialSize(0)
                       .MaxSize(1)
                       .WithFactory(mockPooledObjectFactory.Object)
                       .Instance();

            NonShareable acquired = pool.Acquire();

            pool.Return(acquired);
            NonShareable acquiredObjectInTry;

            Assert.Equal(true, pool.TryAcquire(100, out acquiredObjectInTry));
            Assert.Equal(acquiredObjectInTry, acquired);

            pool.Dispose();
        }