Example #1
0
        public void TouchPathLength_Union_With_A_Null_Test()
        {
            // The type we are testing
            TouchPathLength target = new TouchPathLength();

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

            //Union should fail
            target.Union(anotherRuleData);
        }
Example #2
0
        public void TouchPathLength_Union_Min_Test()
        {
            // The type we are testing
            TouchPathLength target = new TouchPathLength()
            {
                Max = 5,
                Min = 3
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new TouchPathLength()
            {
                Max = 5,
                Min = 1
            };

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

            //We expect the value of the min when union'd, to be the min of the 2nd rule, which is 1
            bool expected = true;
            bool actual = target.Min.Equals(1);

            //Assert they are equal
            Assert.AreEqual(expected, actual);
        }
Example #3
0
        public void TouchPathLength_Union_Nothing_Set_Test()
        {
            // The type we are testing
            TouchPathLength target = new TouchPathLength()
            {
                Max = 7,
                Min = 1
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new TouchPathLength()
            {
                Max = 5,
                Min = 3
            };

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

            //We expect the value of the min to remain the same as the original rule, which is 1
            bool expected = true;
            bool actual = target.Min.Equals(1);

            //Assert they are equal
            Assert.AreEqual(expected, actual);

            //We expect the value of the min to remain the same as the original rule, which is 7
            actual = target.Max.Equals(7);

            //Assert they are equal
            Assert.AreEqual(expected, actual);
        }
Example #4
0
        public void TouchPathLength_Union_Both_Max_And_Min_Test()
        {
            // The type we are testing
            TouchPathLength target = new TouchPathLength()
            {
                Max = 3,
                Min = 2
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new TouchPathLength()
            {
                Max = 5,
                Min = 0
            };

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

            //We expect the value of the min to become the value of the 2nd rule, which is 0
            bool expected = true;
            bool actual = target.Min.Equals(0);

            //Assert they are equal
            Assert.AreEqual(expected, actual);

            //We expect the value of the max to become the value of the 2nd rule, which is 5
            actual = target.Max.Equals(5);

            //Assert they are equal
            Assert.AreEqual(expected, actual);
        }