public void Test_LockForEditing() { try { User iUser = UsersRepository.Instance.GetAllUsers().First(); Assert.IsNull(iUser.Lock_); using (DataContext testContext = new DataContext(connection)) { User testUser = testContext.Users.Find(iUser.ID); testContext.Lock<User>(testUser); testContext.Entry(testUser).Reload(); Assert.IsNotNull(testUser.Lock_); testContext.Unlock<User>(testUser); Assert.IsNull(iUser.Lock_); } } catch (Exception ex) { Assert.Fail(ex.Message); } }