public Evaluate ( IContext context ) : object | ||
context | IContext | |
Résultat | object |
public void EvaluateSimpleNewExpression() { IExpression expression = new NewExpression("System.Data.DataSet", null); object result = expression.Evaluate(new Context()); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(System.Data.DataSet)); }
public void EvaluateSimpleNewExpression() { IExpression dotexpr = new DotExpression(new DotExpression(new VariableExpression("System"), "Data"), "DataSet"); IExpression expression = new NewExpression(dotexpr, null); object result = expression.Evaluate(new Context()); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(System.Data.DataSet)); }
public void EvaluateNewExpressionWithAliasedType() { IExpression expression = new NewExpression(new VariableExpression("Lexer"), new List<IExpression>() { new ConstantExpression(string.Empty) }); Context context = new Context(); context.SetValue("Lexer", typeof(Lexer)); object result = expression.Evaluate(context); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(Lexer)); }
public void EvaluateNewExpressionWithArguments() { IExpression expression = new NewExpression("System.IO.DirectoryInfo", new IExpression[] { new ConstantExpression(".") }); object result = expression.Evaluate(new Context()); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(System.IO.DirectoryInfo)); DirectoryInfo di = (DirectoryInfo)result; DirectoryInfo current = new DirectoryInfo("."); Assert.AreEqual(current.FullName, di.FullName); }