コード例 #1
0
        public void EvalScriptWithExpressionError()
        {
            string script = @"
Hi {{state.Name}},

Time is {{DateTime.sNow.ToString(""MMM dd, yyyy HH:mm:ss"")}}
";

            var    parser = new ScriptParser();
            string result = parser.EvaluateScript(script, new Globals {
                Name = "Rick"
            });

            Assert.IsNull(result, "Parser should have returned null due to the error expression.");
        }
コード例 #2
0
        public void EvalScript()
        {
            string script = @"Hi {{state.Name}},

Time is {{DateTime.Now.ToString(""MMM dd, yyyy HH:mm:ss"")}}
";

            var    parser = new ScriptParser();
            string result = parser.EvaluateScript(script, new Globals {
                Name = "Rick"
            });

            Assert.IsNotNull(result, "Parser failed to parse script: " + parser.ErrorMessage);
            Console.WriteLine(result);
        }
コード例 #3
0
        public void EvalScriptSync()
        {
            string script = @"
Hi {{Name}},

Time is {{DateTime.Now.ToString(""MMM dd, yyyy HH:mm:ss"")}}
";



            var    parser = new ScriptParser();
            string result = parser.EvaluateScript(script, new Globals {
                Name = "Rick"
            });

            Console.WriteLine(result);
        }