Skip to content

Commit

Permalink
Regression test for constant projection after set operation
Browse files Browse the repository at this point in the history
Closes #12568
  • Loading branch information
roji committed Oct 24, 2019
1 parent 27c8d56 commit 4e796ce
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public partial class SimpleQueryCosmosTest
public override Task Union_Take_Union_Take(bool isAsync) => Task.CompletedTask;
public override Task Select_Union(bool isAsync) => Task.CompletedTask;
public override Task Union_Select(bool isAsync) => Task.CompletedTask;
public override Task Union_Select_scalar(bool isAsync) => Task.CompletedTask;
public override Task Union_with_anonymous_type_projection(bool isAsync) => Task.CompletedTask;
public override Task Select_Union_unrelated(bool isAsync) => Task.CompletedTask;
public override Task Select_Union_different_fields_in_anonymous_with_subquery(bool isAsync) => Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,16 @@ public virtual Task Union_Select(bool isAsync)
.Where(a => a.Contains("Hanover")));
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Union_Select_scalar(bool isAsync)
{
return AssertQuery(
isAsync, ss => ss.Set<Customer>()
.Except(ss.Set<Customer>())
.Select(c => (object)1));
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Union_with_anonymous_type_projection(bool isAsync)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,21 @@ FROM [Customers] AS [c0]
WHERE CHARINDEX(N'Hanover', [t].[Address]) > 0");
}

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

AssertSql(
@"SELECT 1
FROM (
SELECT [c].[CustomerID], [c].[Address], [c].[City], [c].[CompanyName], [c].[ContactName], [c].[ContactTitle], [c].[Country], [c].[Fax], [c].[Phone], [c].[PostalCode], [c].[Region]
FROM [Customers] AS [c]
EXCEPT
SELECT [c0].[CustomerID], [c0].[Address], [c0].[City], [c0].[CompanyName], [c0].[ContactName], [c0].[ContactTitle], [c0].[Country], [c0].[Fax], [c0].[Phone], [c0].[PostalCode], [c0].[Region]
FROM [Customers] AS [c0]
) AS [t]");
}

public override async Task Union_with_anonymous_type_projection(bool isAsync)
{
await base.Union_with_anonymous_type_projection(isAsync);
Expand Down

0 comments on commit 4e796ce

Please sign in to comment.