public void EvaluateNewExpressionWithArguments() { IExpression expression = new NewExpression("System.IO.DirectoryInfo", new IExpression[] { new ConstantExpression(".") }); object result = expression.Evaluate(new BindingEnvironment()); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(System.IO.DirectoryInfo)); DirectoryInfo di = (DirectoryInfo)result; DirectoryInfo current = new DirectoryInfo("."); Assert.AreEqual(current.FullName, di.FullName); }
public void EvaluateSimpleNewExpression() { IExpression expression = new NewExpression("System.Data.DataSet", null); object result = expression.Evaluate(new BindingEnvironment()); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(System.Data.DataSet)); }
public void EvaluateNewExpressionWithAliasedType() { IExpression expression = new NewExpression("Channel", null); BindingEnvironment environment = new BindingEnvironment(); environment.SetValue("Channel", typeof(Channel)); object result = expression.Evaluate(environment); Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(Channel)); }