Skip to content

Commit

Permalink
Format lambda expression variables
Browse files Browse the repository at this point in the history
  • Loading branch information
bfriesen committed Feb 1, 2021
1 parent 5b10a8c commit cf5af87
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Moq/StringBuilderExtensions.AppendExpression.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,15 @@ public static StringBuilder AppendExpression(this StringBuilder builder, Express
return builder.AppendExpression((ConditionalExpression)expression);

case ExpressionType.Constant:
return builder.AppendValueOf(((ConstantExpression)expression).Value);
var constantValue = ((ConstantExpression)expression).Value;
if (constantValue is LambdaExpression lambda)
{
return builder.AppendExpression(lambda);
}
else
{
return builder.AppendValueOf(constantValue);
}

case ExpressionType.Parameter:
return builder.AppendExpression((ParameterExpression)expression);
Expand Down

0 comments on commit cf5af87

Please sign in to comment.