private AccountSignUpStrategy MockAccountSignUpStrategyResult(AccountSignUpResult evaluatedResult, Member member) { var strategy = AccountSignUpStrategyDataBuilder.CreateAccountSignUpStrategy(1); _accountSignUpStrategyDataAccessor.GetDefaultStrategy().Returns(strategy); _accountSignUpService.Evaluate(member, strategy).Returns(evaluatedResult); return(strategy); }
public async Task <Account> SignUpAccount(Member member) { var strategy = await _accountSignUpStrategyDataAccessor.GetDefaultStrategy(); var result = _accountSignUpEvaluator.Evaluate(member, strategy); if (!result.IsSuccess) { throw new BusinessException("Sign up account failed for member {memberId}. {error}", BusinessErrors.BadRequest(result.ReasonPhase), member.Id, result.ReasonPhase); } var accountNumberSeq = await _accountDataAccessor.GetNextAccountNumberSeq(); var accountNumber = $"ZIP{accountNumberSeq:D10}"; var account = _accountFactory.Create(accountNumber, member.Id); await _accountDataAccessor.Create(account); return(account); }