public override bool Execute(TransferInput input) { try { _useCase.Transfer( input.Amount, input.Currency, input.SourceAccountNumber, input.DestinationAccountNumber); } catch (AccountNotFoundException) { System.Console.Error.WriteLine("Failed to transfer: Account number does not exist as a checking account"); return(false); } catch (AuthorisationFailedException) { System.Console.Error.WriteLine("Failed to transfer: Authorisation failed"); return(false); } catch (InsufficientBalanceException ibx) { System.Console.Error.WriteLine($"Failed to transfer: {ibx.Message}"); return(false); } return(true); }
public void GivenSourceAccountDoesNotExist_AccountNotFoundExceptionIsThrown() { Action action = () => _useCase.Transfer( 10, "EUR", SourceAccountNumber, DestinationAccountNumber); action.Should() .Throw <AccountNotFoundException>(); }