public override void Can_diff_against_2_2_model() { using var context = new BloggingContext(); DiffSnapshot(new BloggingContextModelSnapshot22(), context); }
public void Inserts_and_updates_are_batched_correctly() { using (var testStore = SqlServerTestStore.Create(DatabaseName)) { var options = new DbContextOptionsBuilder() .UseSqlServer(testStore.Connection, b => b.ApplyConfiguration()) .UseInternalServiceProvider( new ServiceCollection() .AddEntityFrameworkSqlServer() .BuildServiceProvider()) .Options; var expectedBlogs = new List <Blog>(); using (var context = new BloggingContext(options)) { context.Database.EnsureClean(); var owner1 = new Owner { Name = "0" }; var owner2 = new Owner { Name = "1" }; context.Owners.Add(owner1); context.Owners.Add(owner2); var blog1 = new Blog { Id = Guid.NewGuid(), Owner = owner1, Order = 1 }; context.Blogs.Add(blog1); expectedBlogs.Add(blog1); context.SaveChanges(); owner2.Name = "2"; blog1.Order = 0; var blog2 = new Blog { Id = Guid.NewGuid(), Owner = owner1, Order = 1 }; context.Blogs.Add(blog2); expectedBlogs.Add(blog2); var blog3 = new Blog { Id = Guid.NewGuid(), Owner = owner2, Order = 2 }; context.Blogs.Add(blog3); expectedBlogs.Add(blog3); context.SaveChanges(); } AssertDatabaseState(true, expectedBlogs, options); } }