public void RelativeAllTest_AddFrame_CurrentUpdated() { Context target; var obj = CreateTarget(out target); var expr = new ExpressionIs(new KnowledgeRelation { Subject = "Lawyer", Relation = "Occupation of", Target = obj.ToString() }); var actual = target.Evaluate(expr); Assert.AreEqual(EvaluationResult.True, actual); }
public void VariableNotEqual() { // Arrange var variableA = new Variable("a", false, Types.GetTypeShim(typeof(string), true)); var ifParser = CreateParser <EqualParser>("a != null", variableA); // Act var result = (NotEqual)ifParser.Parse(); // Assert Assert.That(result, ExpressionIs.EqualTo(new NotEqual(variableA, Constant.Null))); }
public void RelativeAllTest_All_NotSure() { Context target; var obj = CreateTarget(out target); var expr = new ExpressionIs(new KnowledgeRelation { Subject = "Undercut", Relation = "Hair style of", Target = obj.ToString() }); var rel = new RelativeAll(expr); var actual = target.Evaluate(rel); Assert.AreEqual(EvaluationResult.NotSure, actual); }
public void RelativeAllTest_All_False() { Context target; var obj = CreateTarget(out target); var expr = new ExpressionIs(new KnowledgeRelation { Subject = "Lawyer", Relation = "Occupation of", Target = obj.ToString() }); var rel = new RelativeAll(expr); var actual = target.Evaluate(rel); Assert.AreEqual(EvaluationResult.False, actual); }
public void RelativeBeforeTest_RightNotSure_NotSure() { Context target; var obj = CreateTarget(out target); var expr1 = new ExpressionIs(new KnowledgeRelation { Subject = "Undercut", Relation = "Hair style of", Target = obj.ToString() }); var expr2 = new ExpressionIs(new KnowledgeRelation { Subject = "Lawyer", Relation = "Occupation of", Target = obj.ToString() }); var relative = new RelativeBefore(expr2, expr1); var actual = target.Evaluate(relative); Assert.AreEqual(EvaluationResult.NotSure, actual); }
public void RelativeBeforeTest_True() { Context target; var obj = CreateTarget(out target); var expr1 = new ExpressionIs(new KnowledgeRelation { Subject = "Student", Relation = "Occupation of", Target = obj.ToString() }); var expr2 = new ExpressionIs(new KnowledgeRelation { Subject = "Lawyer", Relation = "Occupation of", Target = obj.ToString() }); var relative = new RelativeBefore(expr1, expr2); var actual = target.Evaluate(relative); Assert.AreEqual(EvaluationResult.True, actual); }