Пример #1
0
        public void RegisterExprEvalWorks()
        {
            var             c     = new RootContext();
            object          r     = null;
            Action <object> saver = o => r = o;
            var             es    = new PlotLingoLib.Statements.ExpressionStatement(new StringValue("hi"));

            c.AddExpressionStatementEvaluationCallback(saver);
            es.Evaluate(c);
            Assert.AreEqual("hi", r, "result of running");
        }
Пример #2
0
        public void TestEvaluationCallback()
        {
            var exp   = new simpleExprForTest();
            int count = 0;
            var c     = new RootContext();

            c.AddExpressionStatementEvaluationCallback(o =>
            {
                count++;
                Assert.IsNull(o, "callback object");
            });
            var expS = new ExpressionStatement(exp);

            expS.Evaluate(c);

            Assert.AreEqual(1, count, "# of times callback was called");
        }