Evaluate() public method

public Evaluate ( Context context, bool withvars = false ) : object
context Context
withvars bool
return object
Ejemplo n.º 1
0
        public void ReceiveMessageWithNoMatch()
        {
            Process process = new Process();
            process.Tell(new Atom("foo"));
            Process.Current = process;

            MatchBody match = new MatchBody(new Atom("ping"), new ConstantExpression("pong"));
            ReceiveExpression expr = new ReceiveExpression(new MatchBody[] { match });

            Assert.IsFalse(expr.HasVariable());

            Assert.IsNull(expr.Evaluate(null));
        }
Ejemplo n.º 2
0
        public void ReceiveMessage()
        {
            Process process = new Process();
            process.Tell(new Atom("ping"));
            Process.Current = process;

            MatchBody match = new MatchBody(new Atom("ping"), new ConstantExpression("pong"));
            ReceiveExpression expr = new ReceiveExpression(new MatchBody[] { match });

            Assert.IsFalse(expr.HasVariable());

            var result = expr.Evaluate(null);

            Assert.IsNotNull(result);
            Assert.AreEqual("pong", result);
        }