Exemplo n.º 1
0
        public void TouchStep_Union_With_Test_TouchCount()
        {
            // The type we are testing
            TouchStep target = new TouchStep()
            {
                TouchCount  = 2
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new TouchStep()
            {
                TouchCount = 5
            };

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

            //We expect the TouchCount of the union to be the TouchCount of 2nd rule, since it is bigger, which is 5
            bool expected = true;
            bool actual = target.TouchCount == 5;
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void TouchStep_Union_With_Nothing_Different_Units_But_Smaller()
        {
            // The type we are testing
            TouchStep target = new TouchStep()
            {
                TouchCount = 1,
                TimeLimit = 1,
                Unit = "sec"
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new TouchStep()
            {
                TouchCount = 1,
                TimeLimit = 2000,
                Unit = "msec"
            };

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

            //We expect the TimeLimit of the union to be the TimeLimit of the 2nd rule, as 2nd TimeLimit is larger
            bool expected = true;
            bool actual = target.TimeLimit == 2;
            Assert.AreEqual(expected, actual);

            //We expect the TouchCount of the union remain the same, as no condition was needed to be met
            expected = true;
            actual = target.TouchCount == 1;
            Assert.AreEqual(expected, actual);

            //We expect the Unit of the union to be the Unit of the 1st rule, despite the 2nd rule being in a different unit
            expected = true;
            actual = target.Unit.Equals("sec");
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 3
0
        public void TouchStep_Union_With_Nothing_Set_In_2nd_Union_Rule()
        {
            // The type we are testing
            TouchStep target = new TouchStep()
            {
                TouchCount = 1,
                TimeLimit = 2,
                Unit = "sec"
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new TouchStep();

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

            //We expect the TimeLimit of the union to remain the same, as nothing was set in 2nd rule
            bool expected = true;
            bool actual = target.TimeLimit == 2;
            Assert.AreEqual(expected, actual);

            //We expect the TouchCount of the union to remain the same, as nothing was set in 2nd rule
            expected = true;
            actual = target.TouchCount == 1;
            Assert.AreEqual(expected, actual);

            //We expect the Unit of the union to remain the same, as nothing was set in 2nd rule
            expected = true;
            actual = target.Unit.Equals("sec");
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 4
0
        public void TouchStep_Union_With_A_Null_Test()
        {
            // The type we are testing

            TouchStep target = new TouchStep();

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

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