Exemple #1
0
        public void OnSameObject_Union_With_Both_True_Conditions()
        {
            // The type we are testing
            OnSameObject target = new OnSameObject()
            {
                Condition = true
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new OnSameObject()
            {
                Condition = true
            };

            //Union the 2 rules
            target.Union(anotherRuleData);

            //We expect the condition of the union to be true, despite both being set to true as per the conditions
            bool expected = true;
            bool actual = target.Condition.Equals(true);

            //Assert they are equal
            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void OnSameObject_Union_With_One_False_Condition()
        {
            // The type we are testing
            OnSameObject target = new OnSameObject()
            {
                Condition = false
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new OnSameObject()
            {
                Condition = true
            };

            //Union the 2 rules
            target.Union(anotherRuleData);

            //We expect the condition of the union to be the condition of 2nd rule, since it was true
            bool expected = true;
            bool actual = target.Condition.Equals(true);

            //Assert they are equal
            Assert.AreEqual(expected, actual);
        }
Exemple #3
0
        public void OnSameObject_Union_With_A_Null_Test()
        {
            // The type we are testing
            OnSameObject target = new OnSameObject()
            {
                //Note that for this test to pass, the condition must be set to false, as the code specifies either 1st rule or 2nd rule to be true
                Condition = false
            };

            // Since the ruleData is null, the union should fail
            IPrimitiveConditionData anotherRuleData = null;

            //Union should fail
            target.Union(anotherRuleData);
        }