public void ReturnsTheSameObjectAfterItsBeenReleased()
        {
            IObjectPool <Dummy> objectPool = BuildObjectPool();

            Dummy dummy = objectPool.Consume();

            objectPool.Release(dummy);

            Dummy dummy2 = objectPool.Consume();

            Assert.AreSame(dummy, dummy2);
            Assert.AreEqual(0, objectPool.GetAmountOfConsumeableObjects());
        }
        public void CheckIfDelegateIsUsedToConstructObjects()
        {
            IObjectPool <Dummy> objectPool = BuildObjectPoolWithConstructorDelegate();
            Dummy dummy = objectPool.Consume();

            Assert.AreEqual("special", dummy.CreatedBy);
        }
        public void CanConsumeObject()
        {
            IObjectPool <Dummy> objectPool = BuildObjectPool();
            Dummy dummy = objectPool.Consume();

            Assert.IsNotNull(dummy);
        }
        public void CanReleaseObject()
        {
            IObjectPool <Dummy> objectPool = BuildObjectPool();
            Dummy dummy = objectPool.Consume();

            objectPool.Release(dummy);

            Assert.AreEqual(1, objectPool.GetAmountOfConsumeableObjects());
        }