NLite.Data.Test.NorthwindExecutionTest.TestCompiledQueryIsolatedWithHeirarchy C# (CSharp) Method

TestCompiledQueryIsolatedWithHeirarchy() private method

private TestCompiledQueryIsolatedWithHeirarchy ( ) : void
return void
        public void TestCompiledQueryIsolatedWithHeirarchy()
        {
            var fn = QueryCompiler.Compile((Northwind n, string id) =>
                n.Customers.Where(c => c.CustomerID == id)
                .Select(c => n.Orders.Where(o => o.CustomerID == c.CustomerID)));
            var items = fn(db, "ALFKI").ToList();

            var list = db.Customers.Select(c => new { City = (c.City == "London" ? null : c.City), Country = (c.CustomerID == "EASTC" ? null : c.Country) })
                        .Where(x => (x.City ?? "NoCity") == "NoCity").ToList();
            AssertValue(6, list.Count);
            AssertValue(null, list[0].City);

            var fn2 = QueryCompiler.Compile((Northwind n, string city, string customerId) => n.Customers.Select(c => new { City = (c.City == city ? null : c.City), Country = (c.CustomerID == customerId ? null : c.Country) })
                        .Where(x => (x.City ?? "NoCity") == "NoCity"));

            list = fn2(db, "London", "EASTC").ToList();
            AssertValue(6, list.Count);
            AssertValue(null, list[0].City);

        }
NorthwindExecutionTest