Beispiel #1
0
        public void TouchStep_TimeLimit_Setter_Not_Test()
        {
            // The type we are testing
            TouchStep target = new TouchStep();

            //Since the TimeLimit was not set, the TimeLimit should be 0
            bool expected = true;
            bool actual = target.TimeLimit == 0;

            //Assert they are the equal
            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
        public void TouchStep_TimeLimit_Setter_Test()
        {
            // The type we are testing
            TouchStep target = new TouchStep()
            {
                TimeLimit = 4
            };

            //Since the TimeLimit was set to 4, we want to check that this was set
            bool expected = true;
            bool actual = 4 == target.TimeLimit;

            //Assert they are the equal
            Assert.AreEqual(expected, actual);
        }
Beispiel #3
0
 public void Init(IPrimitiveConditionData ruleData)
 {
     _data = ruleData as TouchStep;
 }
Beispiel #4
0
        public void TouchStep_toGDL_Test_With_Nothing_Set()
        {
            // The type we are testing
            TouchStep target = new TouchStep();

            // Since the nothing was set in constructor, resulting values and string output of toGDL should be 0 touches within 0
            bool expected = true;
            bool actual = target.ToGDL().Equals("Touch step: 0 touches within 0 ");

            //Assert they are equal
            Assert.AreEqual(expected, actual);
        }
Beispiel #5
0
        public void TouchStep_Unit_Setter_Not_Test()
        {
            // The type we are testing
            TouchStep target = new TouchStep();

            //Since the Unit was not set, the string should be empty
            bool expected = true;
            bool actual = target.Unit.Equals(string.Empty);

            //Assert they are the equal
            Assert.AreEqual(expected, actual);
        }
Beispiel #6
0
        public void TouchStep_Unit_Setter_Test()
        {
            // The type we are testing
            TouchStep target = new TouchStep()
            {
                Unit = "msecs"
            };

            //Since the Unit was set to msecs, we want to check that this was set
            bool expected = true;
            bool actual = target.Unit.Equals("msecs");

            //Assert they are the equal
            Assert.AreEqual(expected, actual);
        }
Beispiel #7
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);
        }
Beispiel #8
0
        public void TouchStep_Unit_Getter_Test()
        {
            // The type we are testing
            TouchStep target = new TouchStep()
            {
                Unit = "msec"
            };

            //Since the Behavior was set to decreasing, we want to check that this was set
            bool expected = true;
            string unitS = "msec";
            bool actual = unitS.Equals(target.Unit);

            //Assert they are the equal
            Assert.AreEqual(expected, actual);
        }
Beispiel #9
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);
        }
Beispiel #10
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);
        }
Beispiel #11
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);
        }
Beispiel #12
0
        public void TouchStep_TouchCount_Setter_Test()
        {
            // The type we are testing
            TouchStep target = new TouchStep()
            {
                TouchCount = 3
            };

            //Since the TouchCount was set to 3, we want to check that this was set
            bool expected = true;
            bool actual = 3 == target.TouchCount;

            //Assert they are the equal
            Assert.AreEqual(expected, actual);
        }
Beispiel #13
0
        public void TouchStep_toGDL_Test_With_Variables_Set()
        {
            // The type we are testing
            TouchStep target = new TouchStep()
            {
                TouchCount = 3,
                TimeLimit = 2,
                Unit = "sec"

            };

            // Since the values were set in the constructor, we expect this in the output of toGDL
            bool expected = true;
            bool actual = target.ToGDL().Equals("Touch step: 3 touches within 2 sec");

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