コード例 #1
0
 public void TestClean()
 {
     binding.Size = 4;
     for (int a = 0; a < binding.Size; a++)
     {
         b.To(new ClassToBeInjected());
     }
     binding.Clean();
     Assert.AreEqual(0, binding.Available);
 }
コード例 #2
0
        public void cleanPools()
        {
            Debug.Log("EnemyPoolManager.clear start");
            foreach (KeyValuePair <string, IPool <GameObject> > pair in _poolList)
            {
                IPool <GameObject> enemyPool = pair.Value;
                enemyPool.Clean();
            }

            Debug.Log("EnemyPoolManager.clear end");
        }
コード例 #3
0
        public void TestExceptionsIfNotPool()
        {
            Binding failBinding = new Binding();
            IPool   fb          = (failBinding as IPool);

            assertThrowsFailedFacade(
                delegate(){ Console.WriteLine(fb.Available); }
                );
            assertThrowsFailedFacade(
                delegate(){ fb.Clean(); }
                );
            assertThrowsFailedFacade(
                delegate(){ fb.GetInstance(); }
                );
            assertThrowsFailedFacade(
                delegate(){ Console.WriteLine(fb.InflationType); }
                );
            assertThrowsFailedFacade(
                delegate(){ fb.InflationType = PoolInflationType.DOUBLE; }
                );
            assertThrowsFailedFacade(
                delegate(){ Console.WriteLine(fb.OverflowBehavior); }
                );
            assertThrowsFailedFacade(
                delegate(){ fb.OverflowBehavior = PoolOverflowBehavior.WARNING; }
                );
            assertThrowsFailedFacade(
                delegate(){ fb.ReturnInstance("hello"); }
                );
            assertThrowsFailedFacade(
                delegate(){ Console.WriteLine(fb.Size); }
                );
            assertThrowsFailedFacade(
                delegate(){ fb.Size = 1; }
                );
        }