public void Union_With_A_Null_Test()
        {
            // The type we are testing
            DistanceBetweenPoints target = new DistanceBetweenPoints()
            {
                Behaviour = BehaviourTypes.UnChanged,
                Max = 2,
                Min = 1
            };

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

            //Union should fail
            target.Union(anotherRuleData);
        }
        public void Union_Unchanged_and_Unchanged()
        {
            // The type we are testing
            DistanceBetweenPoints target = new DistanceBetweenPoints()
            {
                Behaviour = BehaviourTypes.UnChanged,
                Max = 3,
                Min = 1
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new DistanceBetweenPoints()
            {
                Behaviour = BehaviourTypes.UnChanged,
                Max = 4,
                Min = 0
            };

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

            //We expect the min to be the original min and different from the 2nd rule
            bool expected = true;
            bool actual = target.Min.Equals(0);
            Assert.AreNotEqual(expected, actual);

            //We expect the behavior of the union'd rule to be "unchanged", as nothing was union'd
            expected = true;
            actual = target.Behaviour.Equals("unchanged");
            Assert.AreEqual(expected, actual);
        }
        public void Union_Decreasing_and_Decreasing()
        {
            // The type we are testing
            DistanceBetweenPoints target = new DistanceBetweenPoints()
            {
                Behaviour = BehaviourTypes.Decreasing,
                Max = 3,
                Min = 1
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new DistanceBetweenPoints()
            {
                Behaviour = BehaviourTypes.Decreasing,
                Max = 4,
                Min = 0
            };

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

            //We expect the min to be the min of 2nd rule, which is 0
            bool expected = true;
            bool actual = target.Min.Equals(0);
            Assert.AreEqual(expected, actual);

            //We expect the behavior of the union'd rule to be "decreasing", given the union types
            expected = true;
            actual = target.Behaviour.Equals("decreasing");
            Assert.AreEqual(expected, actual);
        }
        public void Union_Unchanged_and_Increasing()
        {
            // The type we are testing
            DistanceBetweenPoints target = new DistanceBetweenPoints()
            {
                Behaviour = BehaviourTypes.UnChanged,
                Max = 2,
                Min = 1
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new DistanceBetweenPoints()
            {
                Behaviour = BehaviourTypes.Increasing,
                Max = 3,
                Min = 2
            };

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

            //We expect the max to be the max of 2nd rule, which is 3
            bool expected = true;
            bool actual = target.Max.Equals(3);
            Assert.AreEqual(expected, actual);

            //We expect the behavior of the union'd rule to be "increasing", given the union types
            expected = true;
            actual = target.Behaviour.Equals("increasing");
            Assert.AreEqual(expected, actual);
        }
        public void Invalid_Union_Test_with_Increasing_and_Decreasing()
        {
            // The type we are testing
            DistanceBetweenPoints target = new DistanceBetweenPoints()
            {
                Behaviour = BehaviourTypes.Increasing,
                Max = -1,
                Min = -1
            };

            // Another instance of same type of ruleData
            IPrimitiveConditionData anotherRuleData = new DistanceBetweenPoints()
            {
                Behaviour = BehaviourTypes.Decreasing,
                Max = -1,
                Min = -1
            };

            // Since the behavior is different (increasing and decreasing), appropriate exception should be shown
            target.Union(anotherRuleData);
        }