public void EditUserNameTest() { UserTable ut = CreateUser(6850, "orelieS4"); _userDataProxy.AddNewUser(ConvertToIUser(ut)); _userDataProxy.EditUserName(6850, "changed-editName_proxy"); IUser user = _userDataProxy.GetUserById(6850); Assert.AreEqual(user.MemberName(), "changed-editName_proxy"); _userDataProxy.DeleteUserById(6850); }
//use-case: user can edit is userName public bool EditUserName(int userId, string newName) { bool toReturn = false; IUser user = _sc.GetUserWithId(userId); if (user == null || !_sc.IsUsernameFree(newName)) { return(toReturn); } toReturn = user.EditUserName(newName); if (toReturn) { _userDataProxy.EditUserName(userId, newName); } return(toReturn); }