Exemple #1
0
        public void TestGetTypeNotPresent()
        {
            RegisterPoolAndAssertion <TypeOne>(1);
            TypeTwo obj = PoolFactory.GetObject <TypeTwo>();

            Assert.IsNull(obj);
        }
Exemple #2
0
        public void TestRegisterOverload()
        {
            int     toCompare = 55;
            TypeTwo toClone   = new TypeTwo(toCompare);

            PoolFactory.RegisterPool(toClone, 2);

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

            Assert.IsNotNull(obj);
            Assert.AreEqual(toCompare, obj.testParam);
        }
Exemple #3
0
        public void TestCompleteFlow()
        {
            PoolFactory.RegisterPool <TypeTwo>();

            // Specify a value to have some instances of objects according to your needs
            PoolFactory.RegisterPool <TypeOne>(10);

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

            // Use methods with "_E" if you want throw Exception
            TypeTwo obj_1 = PoolFactory.GetObject_E <TypeTwo>();

            PoolFactory.Recycle(ref obj_0);
        }
Exemple #4
0
        public override int GetHashCode()
        {
            int rezult = 0;

            rezult += TypeOne.GetHashCode();
            rezult += TypeTwo.GetHashCode();
            if (!String.IsNullOrWhiteSpace(To1))
            {
                rezult += To1.GetHashCode();
            }
            if (!String.IsNullOrWhiteSpace(To2))
            {
                rezult += To2.GetHashCode();
            }
            if (!String.IsNullOrWhiteSpace(Teams))
            {
                rezult += Teams.GetHashCode();
            }
            return(rezult);
        }
Exemple #5
0
 public void TestGetTypeNotPresentThrowException()
 {
     RegisterPoolAndAssertion <TypeOne>(1);
     TypeTwo obj = PoolFactory.GetObject_E <TypeTwo>();
 }