public void FreeAllTest() { var pool = CreateTestPool(); MyTestObj testObj = null; for (var i = 0; i < 25; i++) { testObj = pool.Acquire(); } Assert.AreEqual(25, pool.LiveObjects); pool.FreeAll(x => x == null); Assert.AreEqual(25, pool.LiveObjects); pool.FreeAll(x => x == testObj); Assert.AreEqual(24, pool.LiveObjects); pool.FreeAll(x => x == testObj); Assert.AreEqual(24, pool.LiveObjects); pool.FreeAll(x => x != testObj); Assert.AreEqual(0, pool.LiveObjects); }
public void anAction(MyTestObj obj) { obj.do_work(new AnObject()); }