Beispiel #1
0
 private RuleEvaluationResult AccountNameShouldBeUnique(string name)
 {
     if (_accounts.Contains(name))
     {
         return(RuleEvaluationResult.Fail(name, AccountNameAlreadyExists.WithArgs(new{ Name = name })));
     }
     return(RuleEvaluationResult.Success);
 }
Beispiel #2
0
        RuleEvaluationResult MustHaveSufficientFundsToWitdrawAmount(double amount)
        {
            var newBalance = _balance - amount;

            if (newBalance < 0)
            {
                return(RuleEvaluationResult.Fail(amount, InsufficientFunds.WithArgs(new{ Account = EventSourceId })));
            }
            return(RuleEvaluationResult.Success);
        }
 static RuleEvaluationResult RuleMethod()
 {
     return(RuleEvaluationResult.Fail(instance, cause));
 }