public void RuleValid_Success()
        {
            //Arrange
            LinguisticVariable water = new LinguisticVariable("Water");
            var cold = water.MembershipFunctions.AddTrapezoid("Cold", 0, 0, 20, 40);
            var warm = water.MembershipFunctions.AddTrapezoid("Warm", 30, 50, 50, 70);
            var hot  = water.MembershipFunctions.AddTrapezoid("Hot", 50, 80, 100, 100);

            LinguisticVariable power = new LinguisticVariable("Power");
            var low  = power.MembershipFunctions.AddTrapezoid("Low", 0, 25, 25, 50);
            var high = power.MembershipFunctions.AddTrapezoid("High", 25, 50, 50, 75);

            //Act
            var rule1 = new FuzzyRule().If(water.Is(cold)).Then(power.Is(high));                                        //valid
            var rule2 = new FuzzyRule().If(water.IsNot(cold)).Then(power.Is(high));                                     //valid
            var rule3 = new FuzzyRule().If(water.Is(cold).Or(water.Is(warm))).Then(power.Is(high));                     //valid
            var rule4 = new FuzzyRule().If(water.Is(cold).Or(water.Is(warm)).And(water.Is(hot))).Then(power.Is(high));  //valid
            var rule5 = new FuzzyRule().If(water.Is(cold).And(water.Is(warm)).And(water.Is(hot))).Then(power.Is(high)); //valid
            var rule6 = new FuzzyRule().If(water.Is(cold).Or(water.Is(warm)).Or(water.Is(hot))).Then(power.Is(high));   //valid

            var result1 = rule1.IsValid();
            var result2 = rule2.IsValid();
            var result3 = rule3.IsValid();
            var result4 = rule4.IsValid();
            var result5 = rule3.IsValid();
            var result6 = rule4.IsValid();

            //Assert
            Assert.That(result1, Is.True, "result1");
            Assert.That(result2, Is.True, "result2");
            Assert.That(result3, Is.True, "result3");
            Assert.That(result4, Is.True, "result4");
            Assert.That(result5, Is.True, "result5");
            Assert.That(result6, Is.True, "result6");
        }
        public void RuleInvalid_Success()
        {
            //Arrange
            LinguisticVariable water = new LinguisticVariable("Water");
            var cold = water.MembershipFunctions.AddTrapezoid("Cold", 0, 0, 20, 40);
            var warm = water.MembershipFunctions.AddTrapezoid("Warm", 30, 50, 50, 70);
            var hot  = water.MembershipFunctions.AddTrapezoid("Hot", 50, 80, 100, 100);

            LinguisticVariable power = new LinguisticVariable("Power");
            var low  = power.MembershipFunctions.AddTrapezoid("Low", 0, 25, 25, 50);
            var high = power.MembershipFunctions.AddTrapezoid("High", 25, 50, 50, 75);

            //Act
            var rule4 = new FuzzyRule().If(water.Is(cold).Or(water.Is(warm)));                    //not
            var rule5 = new FuzzyRule().Then(power.Is(high));                                     //not
            var rule6 = new FuzzyRule().If(new List <FuzzyRuleCondition>()).Then(power.Is(high)); //not

            var result1 = rule4.IsValid();
            var result2 = rule5.IsValid();
            var result3 = rule6.IsValid();

            //Assert
            Assert.That(result1, Is.False, "result1");
            Assert.That(result2, Is.False, "result2");
            Assert.That(result3, Is.False, "result3");
        }