Skip to content

Commit

Permalink
Added test for AsQueryable
Browse files Browse the repository at this point in the history
  • Loading branch information
anpete committed Feb 14, 2018
1 parent f12ad5c commit e2a2b9b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/EFCore.Specification.Tests/Query/SimpleQueryTestBase.Where.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,16 @@ public virtual void Where_simple()
entryCount: 6);
}

private static Expression<Func<Order, bool>> _filter = o => o.CustomerID == "ALFKI";

[ConditionalFact]
public virtual void Where_as_queryable_expression()
{
AssertQuery<Customer>(
cs => cs.Where(c => c.Orders.AsQueryable().Any(_filter)),
entryCount: 1);
}

[ConditionalFact]
public virtual void Where_simple_closure()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,23 @@ FROM [Customers] AS [c]
WHERE [c].[City] = N'London'");
}

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

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 EXISTS (
SELECT 1
FROM (
SELECT [o].*
FROM [Orders] AS [o]
WHERE [c].[CustomerID] = [o].[CustomerID]
) AS [t]
WHERE [t].[CustomerID] = N'ALFKI')");
}

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

0 comments on commit e2a2b9b

Please sign in to comment.