private RuleEvaluationResult AccountNameShouldBeUnique(string name) { if (_accounts.Contains(name)) { return(RuleEvaluationResult.Fail(name, AccountNameAlreadyExists.WithArgs(new{ Name = name }))); } return(RuleEvaluationResult.Success); }
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)); }