Example #1
0
        public void GivenAccountDoesNotExist_AccountNotFoundExceptionIsThrown()
        {
            Action action = () => _useCase.DepositTo("DOESNTEXIST", 10, "EUR");

            action
            .Should()
            .Throw <AccountNotFoundException>();
        }
        public override bool Execute(DepositInput input)
        {
            try
            {
                _useCase.DepositTo(input.AccountNumber,
                                   input.Amount,
                                   input.Currency);
            }
            catch (AccountNotFoundException)
            {
                System.Console.Error.WriteLine("Failed to withdraw: Account number does not exist as a checking account");
                return(false);
            }
            catch (AuthorisationFailedException)
            {
                System.Console.Error.WriteLine("Failed to withdraw: Authorisation failed");
                return(false);
            }

            return(true);
        }