public List<IPrimitiveConditionData> GenerateRules(List<TouchPoint2> points) { List<IPrimitiveConditionData> result = new List<IPrimitiveConditionData>(); TouchTime ruleData = new TouchTime(); ruleData.Unit = "secs"; foreach (TouchPoint2 point in points) { if (point.Action == TouchAction.Move) { if (point.Tag == null) { if (point.isFinger) { double length = TrigonometricCalculationHelper.CalculatePathLength(point); if (length >= 5) continue; } } ruleData.Value = point.Age.Seconds; result.Add(ruleData); } } return result; }
public void TouchArea_different_types_equals_false() { TouchArea target = new TouchArea(); TouchTime ruleData = new TouchTime(); bool expected = false; bool actual = target.Equals(ruleData); Assert.AreEqual(expected, actual); }
public void TouchTime_toGDL_Test_With_Nothing_Set() { // The type we are testing TouchTime target = new TouchTime(); // Since cnothing was set in constructor, resulting values and string output of toGDL should be 0 sec bool expected = true; bool actual = target.ToGDL().Equals("Touch time: 0 sec"); //Assert they are equal Assert.AreEqual(expected, actual); }
public void TouchTime_toGDL_Test_With_Variables_Set() { // The type we are testing TouchTime target = new TouchTime() { Value = 5, Unit = "secs" }; // 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 time: 5 secs"); //Assert they are equal Assert.AreEqual(expected, actual); }
public void TouchTime_Union_Test_Unit() { // The type we are testing TouchTime target = new TouchTime() { Unit = "sec" }; // Another instance of same type of ruleData IPrimitiveConditionData anotherRuleData = new TouchTime() { Unit = "msec" }; //Union the 2 rules target.Union(anotherRuleData); //We expect the Unit of the union to be the Unit of original rule bool expected = true; bool actual = target.Unit.Equals("sec"); Assert.AreEqual(expected, actual); }
public void Init(IPrimitiveConditionData ruleData) { _data = ruleData as TouchTime; }
public void TouchTime_Value_Setter_Test() { // The type we are testing TouchTime target = new TouchTime() { Value = 3 }; //Since the Value was set to 3, we want to check that this was set bool expected = true; bool actual = 3 == target.Value; //Assert they are the equal Assert.AreEqual(expected, actual); }
public void TouchTime_Value_Setter_Not_Test() { // The type we are testing TouchTime target = new TouchTime(); //Since the Value was not set, the Value should be 0 bool expected = true; bool actual = target.Value == 0; //Assert they are the equal Assert.AreEqual(expected, actual); }
public void TouchTime_Unit_Setter_Test() { // The type we are testing TouchTime target = new TouchTime() { 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); }
public void TouchTime_Unit_Setter_Not_Test() { // The type we are testing TouchTime target = new TouchTime(); //Since the Unit was not set, the string should be sec bool expected = true; bool actual = target.Unit.Equals("sec"); //Assert they are the equal Assert.AreEqual(expected, actual); }
public void TouchTime_Union_With_Nothing_In_2nd_Union_Rule() { // The type we are testing TouchTime target = new TouchTime() { Value = 3, Unit = "sec" }; // Another instance of same type of ruleData IPrimitiveConditionData anotherRuleData = new TouchTime(); //Union the 2 rules target.Union(anotherRuleData); //We expect the Value of the union to be the Value of the 1st rule, as nothing was set in 2nd rule bool expected = true; bool actual = target.Value == 3; Assert.AreEqual(expected, actual); //We expect the Unit of the union to be the Unit of the 1st rule, as nothing was set in 2nd rule expected = true; actual = target.Unit.Equals("sec"); Assert.AreEqual(expected, actual); }
public void TouchTime_Union_With_Differing_Units_Sec_Msec() { // The type we are testing TouchTime target = new TouchTime() { Value = 1, Unit = "sec" }; // Another instance of same type of ruleData IPrimitiveConditionData anotherRuleData = new TouchTime() { Value = 5000, Unit = "msec" }; //Union the 2 rules target.Union(anotherRuleData); //We expect the Value of the union to be the Value of the 2nd rule, as 2nd was larger bool expected = true; bool actual = target.Value == 5; Assert.AreEqual(expected, actual); //We expect the Unit of the union to be the Unit of the original rule expected = true; actual = target.Unit.Equals("sec"); Assert.AreEqual(expected, actual); }
public void TouchTime_Union_With_A_Null_Test() { // The type we are testing TouchTime target = new TouchTime(); // Since the ruleData is null, the union should fail IPrimitiveConditionData anotherRuleData = null; //Union should fail target.Union(anotherRuleData); }
public void TouchTime_Union_Test_Value() { // The type we are testing TouchTime target = new TouchTime() { Value = 3 }; // Another instance of same type of ruleData IPrimitiveConditionData anotherRuleData = new TouchTime() { Value = 5 }; //Union the 2 rules target.Union(anotherRuleData); //We expect the Value of the union to be the Value of 2nd rule, since it is bigger, which is 5 bool expected = true; bool actual = target.Value == 5; Assert.AreEqual(expected, actual); }