public void CreateUser_would_report_error_if_password_not_valid() { SetUpEmptyUserExpectationForNonExistingUser(); var modelError = new ModelStateDictionary(); _userAuthenticationServiceSUT.Create(new User { UserName = _nonExistignUserName, Password = "******" }, _userName, modelError); Assert.True(modelError.ContainsKey(UserAuthenticationService.PROP_PASSWORD)); Assert.True(modelError.ContainsError(UserAuthenticationService.PROP_PASSWORD, AccountString.NotMatchPasswordRule)); }
public void CreateUser_would_report_error_if_user_exist_already() { SetUpUserExpectationForExistingUser(); var modelError = new ModelStateDictionary(); _userAuthenticationServiceSUT.Create(new User { UserName = _userName }, _userName, modelError); Assert.True(modelError.ContainsKey(UserAuthenticationService.PROP_USERNAME)); Assert.True(modelError.ContainsError(UserAuthenticationService.PROP_USERNAME, AccountString.UserAlreadyExist)); }
public void CreateUser_would_report_error_if_user_name_is_null_or_empty() { var modelError = new ModelStateDictionary(); _userAuthenticationServiceSUT.Create(null, _userName, modelError); Assert.True(modelError.ContainsKey(UserAuthenticationService.PROP_USERNAME)); Assert.True(modelError.ContainsError(UserAuthenticationService.PROP_USERNAME, AccountString.UserNameCanNotBeNull)); }
public void CreateUser_would_report_error_if_the_creator_has_no_rights() { SetUpEmptyUserExpectationForCreateNewAccountWithValidConditions(); var modelError = new ModelStateDictionary(); _userAuthenticationServiceSUT.Create(null, _nonExistignUserName, modelError); Assert.True(modelError.ContainsKey(string.Empty)); Assert.True(modelError.ContainsError(string.Empty, AccountString.CreatorLackOfRight)); }