public void Scenario_Query_With_Skip_And_Take_On_SqlCe35() { using (var context = new SimpleModelContextLegacy()) { Assert.Throws <EntityCommandCompilationException>( () => context.Products.OrderBy(p => p.Name).Skip(3).Take(2).ToList()); } }
public void Scenario_Query_OnSqlCe() { using (var context = new SimpleModelContextLegacy()) { var products = context.Products.ToList(); // Scenario ends; simple validation of final state follows Assert.Equal(7, products.Count); Assert.True(products.TrueForAll(p => GetStateEntry(context, p).State == EntityState.Unchanged)); } }
public void Scenario_IncludeWithLambda_OnSqlCe() { using (var context = new SimpleModelContextLegacy()) { context.Configuration.LazyLoadingEnabled = false; var products = context.Products.Where(p => p != null).Include(p => p.Category).ToList(); foreach (var product in products) { Assert.NotNull(product.Category); } } }
public void Scenario_Find_OnSqlCe() { using (var context = new SimpleModelContextLegacy()) { var product = context.Products.Find(1); var category = context.Categories.Find("Foods"); // Scenario ends; simple validation of final state follows Assert.NotNull(product); Assert.Equal(EntityState.Unchanged, GetStateEntry(context, product).State); Assert.NotNull(category); Assert.Equal(EntityState.Unchanged, GetStateEntry(context, category).State); Assert.Equal("Foods", product.CategoryId); Assert.Same(category, product.Category); Assert.True(category.Products.Contains(product)); } }