示例#1
0
 public UserEntity UpdateUser(UserEntity user)
 {
     try {
         var updatedUser = _userEngine.UpdateUser(user);
         if (updatedUser == null)
         {
             return(null);
         }
         RePullUsers();
         return(updatedUser);
     } catch (Exception e) {
         _exceptionHandlerLogic.LogExceptionAsync(e);
         throw e;
     }
 }
        public void UserEngine_UpdateUser()
        {
            //Arrange: Seed the Mocked Accessor with a list of Users and creates an updated User object
            SeedUsers();
            User user = new User {
                Id       = 1,
                Email    = "*****@*****.**",
                Password = "******"
            };


            //Act: Calls the UserEngine UpdateUser() method to update User with id = 1 to the new version
            User result = userEngine.UpdateUser(user);


            //Assert: Checks that the updated User was returned correctly and that the list of Users contains the updated User
            Assert.AreEqual(user, result, "User was updated incorrectly.");
            CollectionAssert.Contains(mockedUserAccessor.GetState(), user);
        }