public void Deposit_Execute_BalanceUpdatesOK() { DepositTransaction deposit = new DepositTransaction(account, 100); _ = deposit.Execute(); Assert.Equal(200, account.Balance); }
public void Deposit_Executes_ExecutedIsTrue() { DepositTransaction deposit = new DepositTransaction(account, 100); _ = deposit.Execute(); Assert.True(deposit.Executed); }
public void Deposit_Execute_StatusComplete() { DepositTransaction deposit = new DepositTransaction(account, 100); _ = deposit.Execute(); Assert.Equal("Complete", deposit.Status); }
public void Deposit_Rollback_OK() { DepositTransaction deposit = new DepositTransaction(account, 100); _ = deposit.Execute(); _ = deposit.Rollback(); Assert.True(deposit.Reversed); }
public void Deposit_Rollback_InsufficientFundsThrowsInsufficientFundsException() { DepositTransaction deposit = new DepositTransaction(account, 100); _ = deposit.Execute(); WithdrawTransaction withdraw = new WithdrawTransaction(account, 150); _ = withdraw.Execute(); Assert.Throws <InsufficientFundsException>(() => deposit.Rollback()); }
private void DepositarATM() { try { ITransaction transacao = new DepositTransaction(new ATMUI(300)); transacao.Execute(); Console.WriteLine("Valor depositado com sucesso."); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public override void Execute() { _theWithdraw.Execute(); if (_theWithdraw.Success == true) { _theDeposit.Execute(); if (_theDeposit.Success != true) { _theDeposit.Rollback(); } else { base.Execute(); _success = true; } } }
public override void Execute() { base.Execute(); _theWithdrawTransaction.Execute(); if (_theWithdrawTransaction.Success) { _theDepositTransaction.Execute(); if (_theDepositTransaction.Success) { _executed = true; _success = true; } else { _theDepositTransaction.Rollback(); } } }
public void Execute() { try { if (Executed) { throw new Exception("Cannot execute this transaction as it has already been performed."); } _executed = true; _theWithdraw.Execute(); if (_theWithdraw.Success) { _theDeposit.Execute(); } else if (!_theDeposit.Success) { _theDeposit.Rollback(); } } catch (Exception e) { Console.WriteLine("Transfer execute error! " + e.Message); } }
private void ExecuteTransaction(DepositTransaction DepositTransaction) { DepositTransaction.Execute(); }
public void ExecuteTransaction(DepositTransaction transaction) { transaction.Execute(); }
public static void ExecuteTransaction(DepositTransaction transaction) { transaction.Execute(); transaction.Print(); }