public void ExplicitLoadOfNavigationPropertyCollectionIsNotTracked()
        {
            using (var db = new CustomerDbContext())
            {
                var customers = db.Customers.ToList();
                Assert.NotNull(customers);
                Assert.AreEqual(1, customers.Count);
                var queriedCustomer = customers[0];
                Assert.AreEqual("SomeCustomerName", queriedCustomer.Name);

                // explicit load before referencing navigation entity collection
                Assert.AreEqual(0, this.LazyLoadLoggingInterceptor.LazyLoadRuntimes.Count);
                db.Entry(queriedCustomer).Collection(x => x.Invoices).Load();
                Assert.NotNull(queriedCustomer.Invoices);
                Assert.AreEqual(0, this.LazyLoadLoggingInterceptor.LazyLoadRuntimes.Count);

                Assert.AreEqual(3, queriedCustomer.Invoices.Count);
                for (int i = 0; i < queriedCustomer.Invoices.Count; i++)
                {
                    var explicitLoadedInvoice = queriedCustomer.Invoices.ElementAt(i);
                    Assert.AreEqual(1, explicitLoadedInvoice.CustomerId);
                    Assert.AreEqual(i + 1, explicitLoadedInvoice.InvoiceId);
                    Assert.AreEqual($"SomeInvoiceNumber{i + 1}", explicitLoadedInvoice.Number);
                }
            }
        }
        public void ExplicitLoadOfNavigationPropertyReferenceIsTracked()
        {
            using (var db = new CustomerDbContext())
            {
                var invoices = db.Invoices.ToList();
                Assert.NotNull(invoices);
                Assert.AreEqual(3, invoices.Count);
                for (int i = 0; i < invoices.Count; i++)
                {
                    var queriedInvoice = invoices.ElementAt(i);
                    Assert.AreEqual(1, queriedInvoice.CustomerId);
                    Assert.AreEqual(i + 1, queriedInvoice.InvoiceId);
                    Assert.AreEqual($"SomeInvoiceNumber{i + 1}", queriedInvoice.Number);
                }

                // explicit load before referencing navigation entity reference
                Assert.AreEqual(0, this.LazyLoadLoggingInterceptor.LazyLoadRuntimes.Count);
                foreach (var queriedInvoice in invoices)
                {
                    db.Entry(queriedInvoice).Reference(x => x.Customer).Load();
                    var explicitLoadedCustomer = queriedInvoice.Customer;
                    Assert.NotNull(explicitLoadedCustomer);
                    Assert.AreEqual(1, explicitLoadedCustomer.CustomerId);
                    Assert.AreEqual("SomeCustomerName", explicitLoadedCustomer.Name);
                }
                Assert.AreEqual(0, this.LazyLoadLoggingInterceptor.LazyLoadRuntimes.Count);
            }
        }