Beispiel #1
0
 public AccountSignUpResult CanSignUp(Member member, AccountSignUpStrategy strategy)
 {
     if (member.GetMonthNetIncome() < strategy.MonthNetIncomeLimit)
     {
         return(AccountSignUpResult.Fail($"Month net income from member {member.Id} is too low to sign up a account."));
     }
     return(AccountSignUpResult.Success());
 }
 public AccountSignUpResult Evaluate(Member member, AccountSignUpStrategy strategy)
 {
     foreach (var accountSignUpGuard in _signUpGuards)
     {
         var result = accountSignUpGuard.CanSignUp(member, strategy);
         if (!result.IsSuccess)
         {
             return(result);
         }
     }
     return(AccountSignUpResult.Success());
 }