public void Visit_Include_Should_Set_RelatedObjects() { var queryable = Enumerable.Empty <DummyA>().AsQueryable(); var query = from x in queryable.Include(x => x.B1).Include(x => x.B2).Include(x => x.B1).Include(x => x.B2).Include(x => x.B1).Include(x => x.B2) where x.Id == 1 select x; var expression = query.Expression; expression = ExpressionEvaluator.PartialEval(expression); expression = PredicateOperandAligner.Align(expression); expression = PredicateDenormalizer.Denormalize(expression); var queryTranslater = GetQueryTranslator(); queryTranslater.Visit(expression); Assert.AreEqual(2, queryTranslater.RelatedObjects.Count()); Assert.AreEqual("B1", queryTranslater.RelatedObjects.FirstOrDefault()); Assert.AreEqual("B2", queryTranslater.RelatedObjects.LastOrDefault()); }
public void Visit_Include_Should_Set_IncludeSelectors() { var queryable = new List <DummyA> { new DummyA { B1 = new DummyB(), B2 = new DummyB() } }.AsQueryable(); var query = from x in queryable.Include(x => x.B1.DummyAs) where x.Id == 1 select x; var expression = query.Expression; expression = ExpressionEvaluator.PartialEval(expression); expression = PredicateOperandAligner.Align(expression); expression = PredicateDenormalizer.Denormalize(expression); var queryTranslater = GetQueryTranslator(); queryTranslater.Visit(expression); Assert.AreEqual(2, queryTranslater.IncludeSelectors.Count()); }