public IEnumerable <ValidationMessage> Requires(AccountCommand command) { if (string.IsNullOrWhiteSpace(command.AccountId)) { yield return(ValidationMessage.Error("Account id cannot be empty", nameof(command.AccountId))); } }
public IEnumerable <ValidationMessage> Requires(AccountCommand command, AccountState before) { if (command.AccountId != before.AccountId) { yield return(ValidationMessage.Error("This is not the right account", nameof(command.AccountId), nameof(before.AccountId))); } }