Пример #1
0
        public void Split_splits_enumerables_coming_from_Entity_Framework_query_objects()
        {
            var dbContext = new EntityFrameworkTestDatabaseContext();

            for (int i = 0; i < 10; i++)
                dbContext.TestEntities.Add(new TestEntity());

            dbContext.SaveChanges();

            IQueryable<TestEntity> query = dbContext.Set<TestEntity>();

            // Note that we are actually not testing here if the Split() method
            // works properly. We have unit tests to check that.
            // In this case, we are only testing that we can iterate over the result.
            foreach (var testEntity in query.Split(1))
                // THe entity variable is intentionally not used - we are not interested in its content.
                // ReSharper disable UnusedVariable
                foreach (var entity in testEntity) { }
                // ReSharper restore UnusedVariable
        }
Пример #2
0
        public void SetUp()
        {
            DbContext = new EntityFrameworkTestDatabaseContext();

            DbContext.Database.ExecuteSqlCommand(string.Format("DELETE FROM {0}", Identifier.ToString<EntityFrameworkTestDatabaseContext>(x => x.TestEntities)));
        }