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

Test: Add test for Any in where clause with other conditions translat… #5006

Merged
merged 1 commit into from
Apr 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -59,10 +59,10 @@ public virtual void Queryable_reprojection()
AssertQuery<Customer>(
cs => cs.Where(c => c.IsLondon)
.Select(c => new Customer
{
CustomerID = "Foo",
City = c.City
}));
{
CustomerID = "Foo",
City = c.City
}));
}

[ConditionalFact]
Expand Down Expand Up @@ -335,6 +335,19 @@ public virtual void Any_nested3()
&& c.City != "London"));
}

[ConditionalFact]
public virtual void Any_with_multiple_conditions_still_uses_exists()
{
using (var context = CreateContext())
{
var query = context.Customers
.Where(c => c.City == "London" && c.Orders.Any(o => o.EmployeeID == 1))
.ToList();

Assert.Equal(4, query.Count);
}
}

[ConditionalFact]
public virtual void All_top_level()
{
Expand Down Expand Up @@ -1244,7 +1257,7 @@ public virtual void Where_select_many_and()
AssertQuery<Customer, Employee>((cs, es) =>
from c in cs
from e in es
// ReSharper disable ArrangeRedundantParentheses
// ReSharper disable ArrangeRedundantParentheses
where (c.City == "London" && c.Country == "UK")
&& (e.City == "London" && e.Country == "UK")
select new { c, e });
Expand Down Expand Up @@ -4820,7 +4833,7 @@ public virtual void Select_Where_Subquery_Equality()
{
var orders
= (from o in context.Orders.Take(2)
// ReSharper disable once UseMethodAny.0
// ReSharper disable once UseMethodAny.0
where (from od in context.OrderDetails.Take(2)
where (from c in context.Set<Customer>()
where c.CustomerID == o.CustomerID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1360,6 +1360,20 @@ FROM [Orders] AS [o]
Sql);
}

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

Assert.Equal(
@"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].[City] = N'London') AND EXISTS (
SELECT 1
FROM [Orders] AS [o]
WHERE ([o].[EmployeeID] = 1) AND ([c].[CustomerID] = [o].[CustomerID]))",
Sql);
}

public override void All_top_level()
{
base.All_top_level();
Expand Down