Beispiel #1
0
        public void ReturnFalseIfNoAttribute()
        {
            // arrange
            var language        = Language.Default;
            var semanticNetwork = new TestSemanticNetwork(language).SemanticNetwork;

            var concept = ConceptCreationHelper.CreateConcept();

            semanticNetwork.Concepts.Add(concept);

            // act
            var answer = semanticNetwork.Ask().IfIsSign(concept);

            // assert
            Assert.IsFalse(answer.IsEmpty);
            Assert.IsFalse(((BooleanAnswer)answer).Result);
            Assert.AreEqual(0, answer.Explanation.Statements.Count);
        }
Beispiel #2
0
        public void ReturnEmptyAnswerIfNoSigns()
        {
            // arrange
            var language        = Language.Default;
            var semanticNetwork = new TestSemanticNetwork(language).SemanticNetwork;

            var questionWithoutRecursion = new EnumerateSignsQuestion(LogicalValues.True, false);

            // act
            var answerWithoutRecursion = questionWithoutRecursion.Ask(semanticNetwork.Context);
            var answerWithRecursion    = semanticNetwork.Ask().WhichSignsHas(LogicalValues.True);

            // assert
            Assert.IsTrue(answerWithoutRecursion.IsEmpty);
            Assert.AreEqual(0, answerWithoutRecursion.Explanation.Statements.Count);

            Assert.IsTrue(answerWithRecursion.IsEmpty);
            Assert.AreEqual(0, answerWithRecursion.Explanation.Statements.Count);
        }
Beispiel #3
0
        public void ReturnTrueWithoutExplanationIfNoRelationships()
        {
            // arrange
            var language        = Language.Default;
            var semanticNetwork = new TestSemanticNetwork(language).SemanticNetwork;

            var concept = ConceptCreationHelper.CreateConcept();

            concept.WithAttribute(IsValueAttribute.Value);
            semanticNetwork.Concepts.Add(concept);

            // act
            var answer = semanticNetwork.Ask().IfIsValue(concept);

            // assert
            Assert.IsFalse(answer.IsEmpty);
            Assert.IsTrue(((BooleanAnswer)answer).Result);
            Assert.AreEqual(0, answer.Explanation.Statements.Count);
        }
        public void ReturnEmptyAnswerIfNoSigns()
        {
            // arrange
            var language        = Language.Default;
            var semanticNetwork = new TestSemanticNetwork(language).SemanticNetwork;

            var questionWithoutRecursion = new HasSignQuestion(LogicalValues.True, LogicalValues.False, false);

            // act
            var answerWithoutRecursion = questionWithoutRecursion.Ask(semanticNetwork.Context);
            var answerWithRecursion    = semanticNetwork.Ask().IfHasSign(LogicalValues.True, LogicalValues.False);

            // assert
            Assert.IsFalse(answerWithoutRecursion.IsEmpty);
            Assert.IsFalse(((BooleanAnswer)answerWithoutRecursion).Result);
            Assert.AreEqual(0, answerWithoutRecursion.Explanation.Statements.Count);

            Assert.IsFalse(answerWithRecursion.IsEmpty);
            Assert.IsFalse(((BooleanAnswer)answerWithRecursion).Result);
            Assert.AreEqual(0, answerWithoutRecursion.Explanation.Statements.Count);
        }