private void UserRegistration_Register_MemberCreated_PasswordSaved_ConfirmationEmailSent(UserToRegister user) { ReturnDefaultMemberType(); IMember registeredUser = GetRegisteredMember(user); _tokenGenerator.Generate().Returns(GeneratedToken); _memberService.CreateMemberWithIdentity(user.Username, user.Email, user.Name, DefaultMemberTypeAlias).Returns(registeredUser); // Act _userRegistration.Register(user); // Assert AssertIfMemberWasCreated(user, registeredUser, shouldBeApproved: user.Type == UserType.ValtechUk); AsserrIfConfirmationDataWasSaved(); AssertIfConfirmationEmailWasSent(user.Email); }
public Result Register(UserToRegister user) { if (!CanRegister(user)) { _logger.Info($"Cannot register user '{user.Email}' - Already exists"); return(new Result(ErrorCodeType.MemberAlreadyExists, "Already exists")); } try { _userRegistration.Register(user); _logger.Debug($"User '{user.Email}' was registred"); return(Result.Success); } catch (Exception e) { _logger.Error($"Failed to register a new user '{user.Email}'", e); return(new Result(ErrorCodeType.UnknownError)); } }
public Task <HttpResponseMessage> Post([FromBody] RegisterCommand command) { _userRegistration.Register(command); return(Notifiy(_domainNotification, _userNotification)); }
public HomeController(IUsernamePasswordValidator validator, IUserRegistration registration) { _validator = validator; _validator.Validate("foo", "bar"); registration.Register("foo", "bar", "<somepassword>"); }