public void ReturnEmptyAnswerIfThereAreParentSignsButNotRecursive() { // arrange var language = Language.Default; var semanticNetwork = new TestSemanticNetwork(language); var question = new EnumerateSignsQuestion(semanticNetwork.Vehicle_Motorcycle, false); // act var answer = question.Ask(semanticNetwork.SemanticNetwork.Context); // assert Assert.IsTrue(answer.IsEmpty); Assert.AreEqual(0, answer.Explanation.Statements.Count); }
public void TestBuildingWhichSignsHas() { // arrange var language = Language.Default; var semanticNetwork = new TestSemanticNetwork(language); // act var questionRegular = new EnumerateSignsQuestion(semanticNetwork.Vehicle_Car, true); var answerRegular = (ConceptsAnswer)questionRegular.Ask(semanticNetwork.SemanticNetwork.Context); var answerBuilder = (ConceptsAnswer)semanticNetwork.SemanticNetwork.Ask().WhichSignsHas(semanticNetwork.Vehicle_Car); // assert Assert.IsTrue(answerRegular.Result.SequenceEqual(answerBuilder.Result)); Assert.IsTrue(answerRegular.Explanation.Statements.SequenceEqual(answerBuilder.Explanation.Statements)); }
public void ReturnParentOnlySignsIfRecursive() { // arrange var language = Language.Default; var semanticNetwork = new TestSemanticNetwork(language); var question = new EnumerateSignsQuestion(semanticNetwork.Vehicle_Motorcycle, true); // act var answer = (ConceptsAnswer)question.Ask(semanticNetwork.SemanticNetwork.Context); // assert Assert.IsFalse(answer.IsEmpty); Assert.AreEqual(2, answer.Result.Count); Assert.AreEqual(1, answer.Explanation.Statements.OfType <IsStatement>().Count()); Assert.AreEqual(2, answer.Explanation.Statements.OfType <HasSignStatement>().Count()); }
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); }
public void ReturnOwnSignsOnly() { // arrange var language = Language.Default; var semanticNetwork = new TestSemanticNetwork(language); var ownSign = ConceptCreationHelper.CreateConcept(); ownSign.WithAttribute(IsSignAttribute.Value); semanticNetwork.SemanticNetwork.Concepts.Add(ownSign); var ownSignStatement = semanticNetwork.SemanticNetwork.DeclareThat(ownSign).IsSignOf(semanticNetwork.Vehicle_Motorcycle); var question = new EnumerateSignsQuestion(semanticNetwork.Vehicle_Motorcycle, false); // act var answer = (ConceptsAnswer)question.Ask(semanticNetwork.SemanticNetwork.Context); // assert Assert.IsFalse(answer.IsEmpty); Assert.AreSame(ownSign, answer.Result.Single()); Assert.AreSame(ownSignStatement, answer.Explanation.Statements.Single()); }