public void Can_create_DeposeCheque_Command() { var id = Guid.NewGuid(); var funds = 250; var @command = new DeposeCheque(id, funds); Assert.NotNull(@command); Assert.Equal(id, @command.AccountId); Assert.Equal(funds, @command.Funds); }
public CommandResponse Handle(DeposeCheque command) { //how to make it async and also implement the interface? if (!_repository.TryGetById <AccountAggregate.BankAccount>(command.AccountId, out var account)) { throw new InvalidOperationException("No account with such ID"); } account.DeposeCheque(command.Funds, new DeposedCheque(command.AccountId, command.Funds)).Wait(); _repository.Save(account); return(command.Succeed()); }