private void ComputeCanSignUp() { // ReSharper disable once RedundantAssignment string errorMessage = string.Empty; if (string.IsNullOrWhiteSpace(SignUpUserName)) { DisableSignUpWithNoError(); } else if (string.IsNullOrWhiteSpace(SignUpPassword)) { DisableSignUpWithNoError(); } else if (string.IsNullOrWhiteSpace(SignUpConfirmPassword)) { DisableSignUpWithNoError(); } else if (SignUpConfirmPassword != SignUpPassword) { DisableSignUpWithError(PasswordMismatchingErrorMessage); } else if (!_safeProviderForNonExistingUser.IsUserNameValidForNonExistingUser(SignUpUserName, out errorMessage)) { DisableSignUpWithError(errorMessage); } else if (!_safeProviderForNonExistingUser.IsPasswordValidForNonExistingUser(SignUpPassword, out errorMessage)) { DisableSignUpWithError(errorMessage); } else { EnableSignUpWithNoError(); } }
public static void StubPasswordNameValidity(this ISafeProviderForNonExistingUser safeProvider, string password, bool expectedValue, string expectedErrorMessage) { // ReSharper disable once RedundantAssignment string errorMessage = string.Empty; safeProvider.IsPasswordValidForNonExistingUser(password, out errorMessage).Returns(x => { x[1] = expectedErrorMessage; return(expectedValue); }); }