public void EnclosedArea_Union_With_A_Null_Test() { // The type we are testing EnclosedArea target = new EnclosedArea() { Max = 2, Min = 1 }; // Since the ruleData is null, the union should fail IPrimitiveConditionData anotherRuleData = null; //Union should fail target.Union(anotherRuleData); }
public void EnclosedArea_Union_With_Nothing_Set_In_Resulting_Union() { // The type we are testing EnclosedArea target = new EnclosedArea() { Max = 2, Min = 1 }; // Another instance of same type of ruleData IPrimitiveConditionData anotherRuleData = new EnclosedArea() { Max = 2, Min = 1 }; //Union the 2 rules target.Union(anotherRuleData); //We expect the max of the union to be the max of target, since nothing changed, which is 2 bool expected = true; bool actual = target.Max.Equals(2); Assert.AreEqual(expected, actual); //We expect the min of the union to be the min of target, since nothing changed, which is 1 expected = true; actual = target.Min.Equals(1); Assert.AreEqual(expected, actual); }
public void EnclosedArea_Union_Test_Min() { // The type we are testing EnclosedArea target = new EnclosedArea() { Max = 5, Min = 2 }; // Another instance of same type of ruleData IPrimitiveConditionData anotherRuleData = new EnclosedArea() { Max = 5, Min = 1 }; //Union the 2 rules target.Union(anotherRuleData); //We expect the min of the union to be the min of 2nd rule, since it is smaller, which is 1 bool expected = true; bool actual = target.Min.Equals(1); Assert.AreEqual(expected, actual); //We expect the max of the union to remain the same, since nothing changed, which is 5 expected = true; actual = target.Max.Equals(5); Assert.AreEqual(expected, actual); }