Example #1
0
        public void SetValues()
        {
            var conclusion1 = new Models.Variable("conclusion1", "conclusion1", "Should pass");
            var conclusion2 = new Models.Variable("conclusion2", "conclusion2", "Shouldn't pass");

            var service = new ReasoningService();

            var reasoningProcess = MockReasoningProcess(ReasoningMethod.Deduction, conclusion1, conclusion2);

            reasoningProcess = service.ClearReasoning(reasoningProcess);

            var result = service.SetValues(reasoningProcess, new List <IVariable>
            {
                new Models.Variable("var1", 3),
                new Models.Variable("var2", null, "OK"),
                new Models.Variable("var3", new [] { "opt1" })
            });

            Assert.IsFalse(result.KnowledgeBase.RuleSet[0].Predicates[0].LeftTerm.IsEmpty());
            Assert.IsFalse(result.KnowledgeBase.RuleSet[0].Predicates[1].LeftTerm.IsEmpty());
            Assert.IsFalse(result.KnowledgeBase.RuleSet[0].Predicates[2].LeftTerm.IsEmpty());
            Assert.IsFalse(result.KnowledgeBase.RuleSet[1].Predicates[0].LeftTerm.IsEmpty());
            Assert.IsFalse(result.KnowledgeBase.RuleSet[1].Predicates[1].LeftTerm.IsEmpty());
            Assert.IsFalse(result.KnowledgeBase.RuleSet[1].Predicates[2].LeftTerm.IsEmpty());
        }
Example #2
0
        public void GetAllMissingVariableIds()
        {
            var conclusion1 = new Models.Variable("conclusion1", "conclusion1", "Should pass");
            var conclusion2 = new Models.Variable("conclusion2", "conclusion2", "Shouldn't pass");

            var service = new ReasoningService();

            var reasoningProcess = MockReasoningProcess(ReasoningMethod.Deduction, conclusion1, conclusion2);

            reasoningProcess = service.ClearReasoning(reasoningProcess);

            var result = service.GetAllMissingVariableIds(reasoningProcess);

            var enumerable = result.ToList();

            Assert.IsTrue(enumerable.Count == 3);
            Assert.AreEqual("var1", enumerable[0]);
            Assert.AreEqual("var2", enumerable[1]);
            Assert.AreEqual("var3", enumerable[2]);
        }