示例#1
0
        public void ShouldGetAllOfTheCarsWithMakes()
        {
            IIncludableQueryable <Car, Make?> query = Context.Cars.Include(c => c.MakeNavigation);
            var qs   = query.ToQueryString();
            var cars = query.ToList();

            Assert.Equal(9, cars.Count);
        }
示例#2
0
        public void ShouldGetCarsOnOrderWithRelatedProperties()
        {
            IIncludableQueryable <Car, Customer?> query = Context.Cars.Where(c => c.Orders.Any())
                                                          .Include(c => c.MakeNavigation)
                                                          .Include(c => c.Orders).ThenInclude(o => o.CustomerNavigation);
            var qs   = query.ToQueryString();
            var cars = query.ToList();

            Assert.Equal(4, cars.Count);
            cars.ForEach(c =>
            {
                Assert.NotNull(c.MakeNavigation);
                Assert.NotNull(c.Orders.ToList()[0].CustomerNavigation);
            });
        }