public void CanReleaseObject() { IObjectPool <Dummy> objectPool = BuildObjectPool(); Dummy dummy = objectPool.Consume(); objectPool.Release(dummy); Assert.AreEqual(1, objectPool.GetAmountOfConsumeableObjects()); }
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()); }