Esempio n. 1
0
        public void OnSameObject_Condition_Not_Set_Test()
        {
            // The type we are testing
            OnSameObject target = new OnSameObject();

            //Since the condition was not set, we are verifying that it was set to true as specified in original code
            bool expected = true;
            bool actual = target.Condition.Equals(true);

            //Assert they are equal
            Assert.AreEqual(expected, actual);
        }
Esempio n. 2
0
        public void OnSameObject_Condition_Getter_Test()
        {
            // The type we are testing
            OnSameObject target = new OnSameObject()
            {
                Condition = true
            };

            //Since the condition was set, we are verifying that it was set to false as specified in original code
            bool expected = true;
            bool actual = Boolean.Equals(true, target.Condition);

            //Assert they are equal
            Assert.AreEqual(expected, actual);
        }
Esempio n. 3
0
        public void OnSameObject_toGDL_Test_With_Condition_Set()
        {
            // The type we are testing
            OnSameObject target = new OnSameObject()
            {
                Condition = true
            };

            // Since the condition was set in constructor, resulting value and string should indicate true
            bool expected = true;
            bool actual = target.ToGDL().Equals("On same object");

            //Assert they are equal
            Assert.AreEqual(expected, actual);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }