public void TestUnsupportedOperations() { if (!GetType().Equals(typeof(TestBaseObjectPool))) { return; // skip redundant tests } ObjectPool <Object> pool = new InternalObjectPool(); Assert.IsTrue(pool.IdleCount < 0, "Negative expected."); Assert.IsTrue(pool.ActiveCount < 0, "Negative expected."); try { pool.Clear(); Assert.Fail("Expected NotSupportedException"); } catch (NotSupportedException) { // expected } try { pool.AddObject(); Assert.Fail("Expected NotSupportedException"); } catch (NotSupportedException) { // expected } }
public void testClose() { ObjectPool <Object> pool = new InternalObjectPool(); pool.Close(); pool.Close(); // should not error as of Pool 2.0. }