Repository: dotnet/efcore
File: test/EFCore.Specification.Tests/Query/NorthwindWhereQueryTestBase.cs (C#)

Code before:
    [InlineData(false, true)]
    [InlineData(false, false)]
    public virtual Task Where_Enumerable_conditional_not_null_check_with_Contains(bool async, bool someFlag)
        => AssertQuery(
            async,
            ss =>
            {
                // Check also with Enumerable here so we don't inadvertedly remove the null
                // check assuming every IQueryable (possibly converted for Contains) is
                // non-null. See #36986.
                var ids = someFlag ? new List<string> { "ALFKI", "ANATR" } : null;
                return ss.Set<Customer>().Where(c => ids != null && ids.Contains(c.CustomerID));
            },
            assertEmpty: !someFlag);

    [ConditionalTheory]
    [InlineData(true, true)]
    [InlineData(true, false)]
    [InlineData(false, true)]
    [InlineData(false, false)]
    public virtual Task Where_Enumerable_conditional_null_check_with_Contains(bool async, bool someFlag)
        => AssertQuery(
            async,
            ss =>
            {
                // Check also with Enumerable here so we don't inadvertedly remove the null
                // check assuming every IQueryable (possibly converted for Contains) is
                // non-null. See #36986.
                var ids = someFlag ? new List<string> { "ALFKI", "ANATR" } : null;
                return ss.Set<Customer>().Where(c => ids == null || !ids.Contains(c.CustomerID));
            },
            assertEmpty: false);

    [ConditionalTheory, MemberData(nameof(IsAsyncData))]
    public virtual Task Where_collection_navigation_ToList_Count(bool async)
        => AssertQuery(
            async,
            ss => ss.Set<Order>()
                .Where(o => o.OrderID < 10300)
                .OrderBy(o => o.OrderID)
                .Select(o => o.OrderDetails.ToList())
                .Where(e => e.Count() == 4),
            assertOrder: true,
            elementAsserter: (e, a) => AssertCollection(e, a));

    [ConditionalTheory, MemberData(nameof(IsAsyncData))]
    public virtual Task Where_collection_navigation_ToList_Contains(bool async)
    {
        var order = new Order { OrderID = 10248 };

        return AssertQuery(

Review comment (suggestion):
Spelling error: "inadvertedly" should be "inadvertently".

Code after:
            async,
            ss =>
            {
                // Check also with Enumerable here so we don't handle the null check
                // incorrectly because Contains is coverted in
                // QueryableMethodNormalizingExpressionVisitor.TryConvertCollectionContainsToQueryableContains.
                List<string> ids = withNull ? null : ["ALFKI", "ANATR"];
                return ss.Set<Customer>().Where(c => ids == null || !ids.Contains(c.CustomerID));
            });

    [ConditionalTheory, MemberData(nameof(IsAsyncData))]
    public virtual Task Where_collection_navigation_ToList_Count(bool async)
        => AssertQuery(
            async,
            ss => ss.Set<Order>()
                .Where(o => o.OrderID < 10300)
                .OrderBy(o => o.OrderID)
                .Select(o => o.OrderDetails.ToList())
                .Where(e => e.Count() == 4),
            assertOrder: true,
            elementAsserter: (e, a) => AssertCollection(e, a));

    [ConditionalTheory, MemberData(nameof(IsAsyncData))]
    public virtual Task Where_collection_navigation_ToList_Contains(bool async)
    {
        var order = new Order { OrderID = 10248 };

        return AssertQuery(
            async,
            ss => ss.Set<Customer>()
                .Select(c => c.Orders.OrderBy(o => o.OrderID).ToList())
                .Where(e => e.Contains(order)));
    }

    [ConditionalTheory, MemberData(nameof(IsAsyncData))]
    public virtual Task Where_collection_navigation_ToArray_Count(bool async)
        => AssertQuery(
            async,
            ss => ss.Set<Order>()
                .Where(o => o.OrderID < 10300)
                .OrderBy(o => o.OrderID)
                .Select(o => o.OrderDetails.ToArray())
                .Where(e => e.Count() == 4),
            assertOrder: true,
            elementAsserter: (e, a) => AssertCollection(e, a));

    [ConditionalTheory, MemberData(nameof(IsAsyncData))]
    public virtual Task Where_collection_navigation_ToArray_Contains(bool async)
    {
        var order = new Order { OrderID = 10248 };