コード例 #1
0
        public void CanReleaseObject()
        {
            IObjectPool <Dummy> objectPool = BuildObjectPool();
            Dummy dummy = objectPool.Consume();

            objectPool.Release(dummy);

            Assert.AreEqual(1, objectPool.GetAmountOfConsumeableObjects());
        }
コード例 #2
0
        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());
        }