public bool Update(int id, InputDtoUpdateUser inputDtoUpdateUser) { var userFromDto = _userFactory.CreateUserFromValues( inputDtoUpdateUser.Name, HashPassword(inputDtoUpdateUser.Password), inputDtoUpdateUser.Email, inputDtoUpdateUser.Role ); return(_userRepository.Update(id, userFromDto)); }
public void Update_InputDtoAddUser_AreSame() { _userRepository.HashPassword("admin") .Returns("8C6976E5B5410415BDE908BD4DEE15DFB167A9C873FC4BB8A81F6F2AB448A918"); var inputUpdate = new InputDtoUpdateUser("admin", "admin", "*****@*****.**", "admin"); var hashedPassword = _userRepository.HashPassword("admin"); _userFactory.CreateUserFromValues(inputUpdate.Name, hashedPassword, inputUpdate.Email, "admin") .Returns(new User(inputUpdate.Name, hashedPassword, inputUpdate.Email, "admin")); var iuserUpdated = _userFactory.CreateUserFromValues(inputUpdate.Name, hashedPassword, inputUpdate.Email, "admin"); _userRepository.Update(1, iuserUpdated).Returns(true); var res = _userService.Update(1, inputUpdate); Assert.IsTrue(res); }