public void InsertAll_NoProvider_UsesDefaultInsert()
        {
            string fallbackText = null;

            Configuration.DisableDefaultFallback = false;
            Configuration.Log = str => fallbackText = str;

            using (var db = Context.SqlCe())
            {
                if (db.Database.Exists())
                {
                    db.Database.Delete();
                }
                db.Database.Create();
            }

            var list = new List <BlogPost>()
            {
                BlogPost.Create("T1"),
                BlogPost.Create("T2"),
                BlogPost.Create("T3")
            };

            using (var db = Context.SqlCe())
            {
                EFBatchOperation.For(db, db.BlogPosts).InsertAll(list);
            }

            using (var db = Context.SqlCe())
            {
                Assert.AreEqual(3, db.BlogPosts.Count());
            }

            Assert.IsNotNull(fallbackText);
        }
        public void DeleteAll_NoProvider_UsesDefaultDelete()
        {
            string fallbackText = null;

            Configuration.DisableDefaultFallback = false;
            Configuration.Log = str => fallbackText = str;

            using (var db = Context.SqlCe())
            {
                if (db.Database.Exists())
                {
                    db.Database.Delete();
                }

                db.Database.Create();

                db.BlogPosts.Add(BlogPost.Create("T1", DateTime.Today.AddDays(-2)));
                db.BlogPosts.Add(BlogPost.Create("T2.0", DateTime.Today.AddDays(0)));
                db.BlogPosts.Add(BlogPost.Create("T2.1", DateTime.Today.AddDays(0)));
                db.BlogPosts.Add(BlogPost.Create("T3", DateTime.Today.AddDays(2)));

                db.SaveChanges();
            }

            using (var db = Context.SqlCe())
            {
                var lower = DateTime.Today.AddDays(-1);
                var upper = DateTime.Today.AddDays(1);

                var count = EFBatchOperation.For(db, db.BlogPosts).Where(b => b.Created <upper && b.Created> lower && b.Title == "T2.0").Delete();
                Assert.AreEqual(1, count);
            }

            using (var db = Context.SqlCe())
            {
                Assert.AreEqual(3, db.BlogPosts.Count());
            }

            Assert.IsNotNull(fallbackText);
        }