MakeContext() public method

public MakeContext ( object argument, Context context ) : Context
argument object
context Context
return Context
Ejemplo n.º 1
0
        public void DontMatchDifferentAtoms()
        {
            MatchBody match = new MatchBody(new Atom("a"), new ConstantExpression(1));

            var context = match.MakeContext(new Atom("b"), null);

            Assert.IsNull(context);
        }
Ejemplo n.º 2
0
        public void MatchVariableInteger()
        {
            MatchBody match = new MatchBody(new Variable("X"), new VariableExpression(new Variable("X")));

            var context = match.MakeContext(123, null);

            Assert.IsNotNull(context);

            var result = match.Evaluate(context);

            Assert.IsNotNull(result);
            Assert.AreEqual(123, result);
        }
Ejemplo n.º 3
0
        public void MatchAtoms()
        {
            MatchBody match = new MatchBody(new Atom("a"), new ConstantExpression(1));

            var context = match.MakeContext(new Atom("a"), null);

            Assert.IsNotNull(context);

            var result = match.Evaluate(context);

            Assert.IsNotNull(result);
            Assert.AreEqual(1, result);
        }