public void TestAllocateFreeAndReallocate() { GenericObjectPool <TestPoolAllocation> pool = new GenericObjectPool <TestPoolAllocation>(); pool.SetFactory(new TestPoolAllocationFactory()); Method1(pool); GC.Collect(); GC.Collect(); // Delay is needed so that the Garbage compacter runs Thread.Sleep(500); Console.WriteLine("NumActive (" + pool.NumActive + ") NumIdle (" + pool.NumIdle + ")"); NUnit.Framework.Assert.AreEqual(0, pool.NumActive); NUnit.Framework.Assert.AreEqual(1, pool.NumIdle); Method2(pool); }