public void ShouldCreateExpressionWithSimpleLambda() { var generator = new LambdaExpressionGenerator(() => new Foo()); var expression = generator.GenerateExpression(typeof(Foo)); Assert.NotNull(expression); var unary = expression as UnaryExpression; Assert.IsNotNull(unary); Assert.AreEqual(ExpressionType.Convert, unary.NodeType); }
public void ShouldCreateCompilableExpression() { var generator = new LambdaExpressionGenerator(() => new Foo()); var expression = generator.GenerateExpression(typeof(Foo)); var func = Expression.Lambda<Func<Foo>>(expression).Compile(); var o = func(); Assert.IsNotNull(o); }