public void GetInUse_IndicatesUsedQuantity() { // setup PPocoPool.Clear <TestClass>(); // arrange int count = 3; TestClass[] gos = new TestClass[count]; // act for (int i = 0; i < count; i++) { gos[i] = PPocoPool.Get <TestClass>(); } int resultForUsed = PPocoPool.GetInUse <TestClass>(); for (int i = 0; i < count; i++) { PPocoPool.Put(gos[i]); } int resultForReclaimed = PPocoPool.GetInUse <TestClass>(); // assert Assert.AreEqual(count, resultForUsed, "Pool has wrong number of active objects"); Assert.AreEqual(0, resultForReclaimed, "Pool has wrong number of active objects"); }
public void Clear_DestroysAllObjects() { // setup PPocoPool.Clear <TestClass>(); // arrange int count = 9; // act PPocoPool.Prewarm <TestClass>(count); PPocoPool.Clear <TestClass>(); int total = PPocoPool.GetAvailable <TestClass>() + PPocoPool.GetInUse <TestClass>(); // assert Assert.AreEqual(0, total, "Pool contains objects"); }