コード例 #1
0
 public override void Given()
 {
     request = new LoanRequest {
             Customer = new Customer { CreditScore = 10, GoldCustomer = true },
             Value = 9000
         };
 }
コード例 #2
0
 public Either <LoanDeclinedReason, LoanRequest> CheckSillyAmount(LoanRequest request)
 {
     if (request.Value > 1000000)
     {
         return(Either.Left(LoanDeclinedReason.LoanRequestTooHigh));
     }
     return(Either.Right(request));
 }
コード例 #3
0
 //here are some business rules
 public Either <LoanDeclinedReason, LoanRequest> CheckCustomerCredit(LoanRequest request)
 {
     if (request.Customer.CreditScore > 8)
     {
         return(Either.Right(request));
     }
     return(Either.Left(LoanDeclinedReason.InsufficientCreditScore));
 }
コード例 #4
0
 public override void Given()
 {
     request = new LoanRequest {
         Customer = new Customer {
             CreditScore = 10, GoldCustomer = true
         },
         Value = 9000
     };
 }
コード例 #5
0
 public Either<LoanDeclinedReason, LoanRequest> CheckGoldPrerequisiteCustomer(LoanRequest request)
 {
     if (request.Value < 10000) return Either.Right(request); //dont need gold status for less than 10,000
     if (request.Customer.GoldCustomer) return Either.Right(request);
     return Either.Left(LoanDeclinedReason.RequiresGoldCustomer);
 }
コード例 #6
0
 //here are some business rules
 public Either<LoanDeclinedReason, LoanRequest> CheckCustomerCredit(LoanRequest request)
 {
     if (request.Customer.CreditScore > 8) return Either.Right(request);
     return Either.Left(LoanDeclinedReason.InsufficientCreditScore);
 }
コード例 #7
0
 public Either<LoanDeclinedReason, LoanRequest> CheckSillyAmount(LoanRequest request)
 {
     if (request.Value > 1000000)
         return Either.Left(LoanDeclinedReason.LoanRequestTooHigh);
     return Either.Right(request);
 }
コード例 #8
0
 public Either <LoanDeclinedReason, LoanRequest> CheckGoldPrerequisiteCustomer(LoanRequest request)
 {
     if (request.Value < 10000)
     {
         return(Either.Right(request));                       //dont need gold status for less than 10,000
     }
     if (request.Customer.GoldCustomer)
     {
         return(Either.Right(request));
     }
     return(Either.Left(LoanDeclinedReason.RequiresGoldCustomer));
 }