Esempio n. 1
0
        public void TestCreatWithNoObjectsAndGet()
        {
            RegisterPoolAndAssertion <TypeOne>(1, 0);
            TypeOne obj = PoolFactory.GetObject <TypeOne>();

            Assert.IsNotNull(obj);
            Assert.AreEqual(0, PoolFactory.GetPoolSize <TypeOne>());

            PoolFactory.Recycle(ref obj);
            Assert.AreEqual(1, PoolFactory.GetPoolSize <TypeOne>());
        }
Esempio n. 2
0
        public void TestRecycle()
        {
            RegisterPoolAndAssertion <TypeOne>(1);
            Assert.AreEqual(10, PoolFactory.GetPoolSize <TypeOne>());

            TypeOne obj = PoolFactory.GetObject <TypeOne>();

            Assert.AreEqual(9, PoolFactory.GetPoolSize <TypeOne>());

            PoolFactory.Recycle(ref obj);
            Assert.AreEqual(10, PoolFactory.GetPoolSize <TypeOne>());
        }