Related to #153, the following test produces invalid SQL that results in a SqlException with the message Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
[ConditionalFact]
public virtual void Where_subquery_on_collection()
{
AssertQuery<Product, OrderDetail>((pr, od) =>
pr.Where(
p => od
.Where(o => o.ProductID == p.ProductID)
.Select(odd => odd.Quantity).Contains<short>(5)));
}
SELECT [p].[ProductID], [p].[Discontinued], [p].[ProductName], [p].[UnitsInStock]
FROM [Products] AS [p]
WHERE (
SELECT [o].[Quantity]
FROM [Order Details] AS [o]
WHERE [o].[ProductID] = [p].[ProductID]
) = 1