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());
 }
Beispiel #2
0
 private static async Task CreateAccountSingUpStrategy(UserContext context)
 {
     var strategy = new AccountSignUpStrategy
     {
         IsDefault           = true,
         Name                = "Master Program",
         MonthNetIncomeLimit = 100
     };
     await context.AccountSignUpStrategies.AddAsync(strategy);
 }
 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());
 }
 public AccountSignUpResult CanSignUp(Member member, AccountSignUpStrategy strategy)
 {
     return(AccountSignUpResult.Fail("always failed!"));
 }
 public AccountSignUpResult CanSignUp(Member member, AccountSignUpStrategy strategy)
 {
     return(AccountSignUpResult.Success());
 }