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 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_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_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_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); }