public void RoleShouldBeUpdated() { using (ContextDb testDb = new ContextDb()) { testDb.Roles.Attach(expectedRole); testDb.Entry(expectedRole).State = EntityState.Modified; testDb.SaveChanges(); } using (ContextDb testDb = new ContextDb()) { Role actualRole = testDb.Roles.Find(expectedRole.Id); Assert.IsFalse(ReferenceEquals(expectedRole, actualRole)); Assert.AreEqual(expectedRole, actualRole); } }
public void UserShouldBeUpdated() { using(ContextDb testDb = new ContextDb()) { testDb.Users.Attach(expectedUser); testDb.Entry(expectedUser).State = EntityState.Modified; testDb.SaveChanges(); } using (ContextDb testDb = new ContextDb()) { User actualUser = testDb.Users.Find(expectedUser.Id); Assert.IsFalse(ReferenceEquals(expectedUser, actualUser)); Assert.AreEqual(expectedUser, actualUser); } }