Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query: Add regression test for #12337 #19196

Merged
merged 3 commits into from
Dec 7, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1032,6 +1032,12 @@ public override Task LastOrDefault_member_access_in_projection_translates_to_ser
return base.LastOrDefault_member_access_in_projection_translates_to_server(async);
}

[ConditionalTheory(Skip = "Issue#17246")]
public override Task Collection_projection_AsNoTracking_OrderBy(bool async)
{
return base.Collection_projection_AsNoTracking_OrderBy(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 @@ -1593,5 +1593,27 @@ public CustomerWrapper(Customer customer)
public string City { get; set; }
public Customer Customer { get; }
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Collection_projection_AsNoTracking_OrderBy(bool async)
{
return AssertQuery(
async,
ss => (from c in ss.Set<Customer>()
select new
{
c.CustomerID,
Orders = c.Orders.Select(o => o.OrderDate).ToList()
})
.AsNoTracking()
.OrderBy(a => a.CustomerID),
assertOrder: true,
elementAsserter: (e, a) =>
{
Assert.Equal(e.CustomerID, a.CustomerID);
AssertCollection(e.Orders, a.Orders, elementSorter: i => i, elementAsserter: (ie, ia) => Assert.Equal(ie, ia));
});
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -1271,6 +1271,37 @@ FROM [Customers] AS [c]
WHERE [c].[CustomerID] LIKE N'A%'");
}

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

AssertSql(
@"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]
WHERE [c].[CustomerID] = N'ALFKI'");
}

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

AssertSql(
@"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]
WHERE [c].[CustomerID] = N'ALFKI'");
}

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

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

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

Expand Down