Пример #1
0
 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);
     }
 }
Пример #2
0
 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);
     }
 }