public void Quoter_Environment_Expressible3() { var quoter = new Quoter(DefaultExpressionPolicy.Instance); var expr = (Expression <Func <int, Quotable> >)(x => Quotable.Create(x)); var res = quoter.Visit(expr); var obj = (Func <int, Quotable>)res.Evaluate(); var value = obj(42); var quote = value.Expression; var eq = new ExpressionEqualityComparer(); Assert.IsTrue( eq.Equals( ((MethodCallExpression)expr.Body).Update(null, new[] { Expression.Constant(42) }), quote ) ); }
public void Quoter_Expressible3() { var quoter = new Quoter(DefaultExpressionPolicy.Instance); var expr = (Expression <Func <Quotable> >)(() => Quotable.Create()); var res = quoter.Visit(expr); var obj = (Func <Quotable>)res.Evaluate(); var value = obj(); var quote = value.Expression; var eq = new ExpressionEqualityComparer(); Assert.IsTrue( eq.Equals( expr.Body, quote ) ); }