Skip to content

Commit

Permalink
Add regression tests for #19059 #19060
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Dec 20, 2019
1 parent 00c256f commit fc8c356
Showing 1 changed file with 93 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,9 @@ public virtual Task Where_bool_client_side_negated(bool async)
ss => ss.Set<Product>().Where(p => !ClientFunc(p.ProductID) && p.Discontinued), entryCount: 8));
}

#pragma warning disable IDE0060 // Remove unused parameter
private static bool ClientFunc(int id)
#pragma warning restore IDE0060 // Remove unused parameter
{
return false;
}
Expand Down Expand Up @@ -1994,5 +1996,96 @@ public virtual Task Using_same_parameter_twice_in_query_generates_one_sql_parame
ss => ss.Set<Customer>().Where(c => i + c.CustomerID + i == c.CompanyName)
.Select(c => c.CustomerID));
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Where_ToList_Count(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Customer>().Select(c => ss.Set<Order>().Where(o => o.CustomerID == c.CustomerID).ToList())
.Where(e => e.Count() == 0),
entryCount: 6);
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Where_ToList_Contains(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Customer>()
.Select(c => ss.Set<Order>().Where(o => o.CustomerID == c.CustomerID).Select(o => o.CustomerID).ToList())
.Where(e => e.Contains("ALFKI")),
entryCount: 6);
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Where_ToArray_Count(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Customer>().Select(c => ss.Set<Order>().Where(o => o.CustomerID == c.CustomerID).ToArray())
.Where(e => e.Count() == 0),
entryCount: 6);
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Where_ToArray_Contains(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Customer>()
.Select(c => ss.Set<Order>().Where(o => o.CustomerID == c.CustomerID).Select(o => o.CustomerID).ToArray())
.Where(e => e.Contains("ALFKI")),
entryCount: 6);
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Where_AsEnumerable_Count(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Customer>().Select(c => ss.Set<Order>().Where(o => o.CustomerID == c.CustomerID).AsEnumerable())
.Where(e => e.Count() == 0),
entryCount: 6);
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Where_AsEnumerable_Contains(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Customer>()
.Select(c => ss.Set<Order>().Where(o => o.CustomerID == c.CustomerID).Select(o => o.CustomerID).AsEnumerable())
.Where(e => e.Contains("ALFKI")),
entryCount: 6);
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Where_ToList_Count_member(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Customer>().Select(c => ss.Set<Order>().Where(o => o.CustomerID == c.CustomerID).ToList())
.Where(e => e.Count == 0),
entryCount: 6);
}

[ConditionalTheory]
[MemberData(nameof(IsAsyncData))]
public virtual Task Where_ToArray_Length_member(bool async)
{
return AssertQuery(
async,
ss => ss.Set<Customer>().Select(c => ss.Set<Order>().Where(o => o.CustomerID == c.CustomerID).ToArray())
.Where(e => e.Length == 0),
entryCount: 6);
}
}
}

0 comments on commit fc8c356

Please sign in to comment.