Exemplo 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));
        }
Exemplo 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);
        }