public void Detached_BaseEntityUpdateWhenKeyExistsInContext() { using (var context = new TestDbContext(_connection)) { var company1 = context.Companies.Single(p => p.Id == 2); // Create detached entity company1 = new Models.Company() { Id = company1.Id, Name = "Company #1", // Change from Company 1 to Company #1, }; context.UpdateGraph(company1, null); context.SaveChanges(); } using (var context = new TestDbContext(_connection)) { Assert.IsTrue(context.Companies.Single(p => p.Id == 2).Name == "Company #1"); } }