Skip to content

Commit

Permalink
Add tests to verify dotnet#7497 is fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
tuespetre committed Feb 4, 2017
1 parent c13f7f5 commit fa5ec0b
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6810,6 +6810,20 @@ public virtual void Skip_LongCount()
cs => cs.Skip(7).LongCount());
}

[ConditionalFact]
public virtual void GroupJoin_Count()
{
AssertQuery<Customer, Order>(
(cs, os) => cs.GroupJoin(os, c => c.CustomerID, o => o.CustomerID, (c, o) => o).Count());
}

[ConditionalFact]
public virtual void GroupJoin_Count_grouped_items_not_referenced()
{
AssertQuery<Customer, Order>(
(cs, os) => cs.GroupJoin(os, c => c.CustomerID, o => o.CustomerID, (c, o) => c).Count());
}

private static IEnumerable<TElement> ClientDefaultIfEmpty<TElement>(IEnumerable<TElement> source)
{
return source?.Count() == 0 ? new[] { default(TElement) } : source;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7085,6 +7085,28 @@ OFFSET @__p_0 ROWS
Sql);
}

public override void GroupJoin_Count()
{
base.GroupJoin_Count();

Assert.Equal(
@"SELECT [c].[CustomerID], [o].[CustomerID]
FROM [Customers] AS [c]
LEFT JOIN [Orders] AS [o] ON [c].[CustomerID] = [o].[CustomerID]
ORDER BY [c].[CustomerID]",
Sql);
}

public override void GroupJoin_Count_grouped_items_not_referenced()
{
base.GroupJoin_Count_grouped_items_not_referenced();

Assert.Equal(
@"SELECT COUNT(*)
FROM [Customers] AS [c]",
Sql);
}

private const string FileLineEnding = @"
";

Expand Down

0 comments on commit fa5ec0b

Please sign in to comment.