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."); }
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); }
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); }