Skip to content

Commit

Permalink
Query: Add regression test for #12437
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Dec 6, 2019
1 parent d5ea671 commit 5e53d85
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3976,6 +3976,12 @@ public override Task SelectMany_correlated_subquery_hard(bool async)
return base.SelectMany_correlated_subquery_hard(async);
}

[ConditionalTheory(Skip = "Issue #17246")]
public override Task Subquery_DefaultIfEmpty_Any(bool async)
{
return base.Subquery_DefaultIfEmpty_Any(async);
}

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5463,5 +5463,18 @@ public virtual Task AsQueryable_in_query_server_evals(bool async)
}

private static Expression<Func<Order, bool>> ValidYear => a => a.OrderDate.Value.Year == 1998;

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Subquery_DefaultIfEmpty_Any(bool async)
{
return AssertAny(
async,
ss => (from e in ss.Set<Employee>()
.Where(e => e.EmployeeID == NonExistentID)
.Select(e => e.EmployeeID)
.DefaultIfEmpty()
select e));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4691,6 +4691,26 @@ ORDER BY [o].[OrderID]
ORDER BY [c].[CustomerID], [t].[OrderID]");
}

public override async Task Subquery_DefaultIfEmpty_Any(bool async)
{
await base.Subquery_DefaultIfEmpty_Any(async);

AssertSql(
@"SELECT CASE
WHEN EXISTS (
SELECT 1
FROM (
SELECT NULL AS [empty]
) AS [empty]
LEFT JOIN (
SELECT [e].[EmployeeID], [e].[City], [e].[Country], [e].[FirstName], [e].[ReportsTo], [e].[Title]
FROM [Employees] AS [e]
WHERE [e].[EmployeeID] = -1
) AS [t] ON 1 = 1) THEN CAST(1 AS bit)
ELSE CAST(0 AS bit)
END");
}

private void AssertSql(params string[] expected)
=> Fixture.TestSqlLoggerFactory.AssertBaseline(expected);

Expand Down

0 comments on commit 5e53d85

Please sign in to comment.