AIMA.Test.Core.Unit.Logic.FOL.UnifierTest.testSimpleVariableUnification C# (CSharp) Method

testSimpleVariableUnification() private method

private testSimpleVariableUnification ( ) : void
return void
        public void testSimpleVariableUnification()
        {
            Variable var1 = new Variable("x");
            List<Term> terms1 = new List<Term>();
            terms1.Add(var1);
            Predicate p1 = new Predicate("King", terms1); // King(x)

            List<Term> terms2 = new List<Term>();
            terms2.Add(new Constant("John"));
            Predicate p2 = new Predicate("King", terms2); // King(John)

            Dictionary<Variable, Term> result = unifier.unify(p1, p2, theta);
            Assert.AreEqual(theta, result);
            Assert.AreEqual(1, theta.Keys.Count);
            Assert.IsTrue(theta.ContainsKey(new Variable("x"))); // x =
            Assert.AreEqual(new Constant("John"), theta[var1]); // John
        }