public static string ConvertMockExpressionToString(Expression expr) { string result = expr.Type.ToString(); var replacer = new ClosureWithSafeParameterReplacer(); var lambda = expr as LambdaExpression; if (lambda != null) { expr = lambda.Body; } expr = replacer.Visit(expr); var cleanedExpr = MakeVoidLambda(expr, replacer.Parameters); result = cleanedExpr.ToString(); result = replacer.CleanExpressionString(result); return(result); }
public static string ConvertMockExpressionToString(Expression expr) { string result = expr.Type.ToString(); var replacer = new ClosureWithSafeParameterReplacer(); var lambda = expr as LambdaExpression; if (lambda != null) expr = lambda.Body; expr = replacer.Visit(expr); var cleanedExpr = MakeVoidLambda(expr, replacer.Parameters); result = cleanedExpr.ToString(); result = replacer.CleanExpressionString(result); return result; }