Fixed broken tests

This commit is contained in:
Koen
2022-10-13 13:22:55 +01:00
parent ed7f8c5940
commit a640053048
7 changed files with 95 additions and 5 deletions
@@ -138,7 +138,7 @@ namespace EntityFrameworkCore.Projectables.Generated
[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
public static class {generatedClassName}
{{
public static System.Linq.Expressions.Expression<System.Func<{lambdaTypeArguments.Arguments}, {projectable.ReturnTypeName}>> Expression{(projectable.TypeParameterList?.Parameters.Any() == true ? projectable.TypeParameterList.ToString() : string.Empty)}()");
public static System.Linq.Expressions.Expression<System.Func<{(lambdaTypeArguments.Arguments.Any() ? $"{lambdaTypeArguments.Arguments}, " : "")}{projectable.ReturnTypeName}>> Expression{(projectable.TypeParameterList?.Parameters.Any() == true ? projectable.TypeParameterList.ToString() : string.Empty)}()");
if (projectable.ConstraintClauses is not null)
{
@@ -47,10 +47,13 @@ namespace EntityFrameworkCore.Projectables.Services
var mappedArgumentExpression = (parameterIndex, node.Object) switch {
(0, not null) => node.Object,
(_, not null) => node.Arguments[parameterIndex - 1],
(_, null) => node.Arguments[parameterIndex]
(_, null) => node.Arguments.Count > parameterIndex ? node.Arguments[parameterIndex] : null
};
_expressionArgumentReplacer.ParameterArgumentMapping.Add(parameterExpession, mappedArgumentExpression);
if (mappedArgumentExpression is not null)
{
_expressionArgumentReplacer.ParameterArgumentMapping.Add(parameterExpession, mappedArgumentExpression);
}
}
var updatedBody = _expressionArgumentReplacer.Visit(reflectedExpression.Body);