public async Task NewAccount_Should_Allows_Closing2() { var getAccountPresenter = new GetAccountDetailsPresenter(); var closeAccountPresenter = new CloseAccountPresenter(); var withdrawPresenter = new WithdrawPresenter(); var getAccountUseCase = new Application.UseCases.GetAccountDetailsUseCase( getAccountPresenter, this._fixture.AccountRepository); var withdrawUseCase = new Application.UseCases.WithdrawUseCase( this._fixture.AccountService, withdrawPresenter, this._fixture.AccountRepository, this._fixture.UnitOfWork); var sut = new Application.UseCases.CloseAccountUseCase( closeAccountPresenter, this._fixture.AccountRepository); await getAccountUseCase.Execute(new GetAccountDetailsInput( this._fixture.Context.DefaultAccountId)); var getAccountDetailtOutput = getAccountPresenter.GetAccountDetails.First(); await withdrawUseCase.Execute(new Application.Boundaries.Withdraw.WithdrawInput( this._fixture.Context.DefaultAccountId, new PositiveMoney(getAccountDetailtOutput.CurrentBalance.ToDecimal()))); var input = new CloseAccountInput( this._fixture.Context.DefaultAccountId); await sut.Execute(input); Assert.Equal(input.AccountId, closeAccountPresenter.ClosedAccounts.First().AccountId); }
public async Task Withdraw_Valid_Amount( decimal amount, decimal expectedBalance) { var presenter = new WithdrawPresenter(); var sut = new WithdrawUseCase(this._fixture.AccountService, presenter, this._fixture.AccountRepository, this._fixture.UnitOfWork); await sut.Execute(new WithdrawInput(this._fixture.Context.DefaultAccountId, new PositiveMoney(amount))); var actual = presenter.Withdrawals.Last(); Assert.Equal(expectedBalance, actual.UpdatedBalance.ToDecimal()); }
public async Task Withdraw_Invalid_NotExactlyAmount( decimal amount) { var presenter = new WithdrawPresenter(); var sut = new WithdrawTransactionUseCase( presenter, _fixture.ATMTransactionService); var actualEx = await Assert.ThrowsAsync <WithdrawValueCannotBeExactlyRepresentedException>( async() => await sut.ExecuteAsync(new WithdrawTransactionInput( new PositiveMoney(amount)))); Assert.Contains("cannot be exactly represente", actualEx.Message, StringComparison.OrdinalIgnoreCase); }
public Withdraw(double totalEfectivo, bool cancel) { _withdrawPresenter = new WithdrawPresenter(new WithdrawServices()); InitializeComponent(); _totalEfectivo = totalEfectivo; CashAvailable.Text = _totalEfectivo.ToString("C2"); if (cancel == false) { cancelWithdraw.Visibility = Visibility.Collapsed; } cortesToSave = _withdrawPresenter.GetCurrentCashClose(App._userApplication.idUsuario); idcorte = cortesToSave.IdCorte; getWithdraws(); System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); }
public async Task Withdraw_Valid_Amount2( decimal amount, IEnumerable <BillQuantity> expectedBills) { var presenter = new WithdrawPresenter(); var sut = new WithdrawTransactionUseCase( presenter, _fixture.ATMTransactionService); await sut.ExecuteAsync(new WithdrawTransactionInput( new PositiveMoney(amount))); var actual = presenter.WithdrawResponse; Assert.Equal(expectedBills, actual.BillQuantities); }
public AccountsController( IInputBoundary <CloseCommand> closeAccountnput, IInputBoundary <DepositCommand> depositnput, IInputBoundary <WithdrawCommand> withdrawInput, IInputBoundary <GetAccountDetailsCommand> getAccountDetailsInput, ClosePresenter closePresenter, DepositPresenter depositPresenter, WithdrawPresenter withdrawPresenter, AccountDetailsPresenter getAccountDetailsPresenter) { this.closeAccountInput = closeAccountnput; this.depositInput = depositnput; this.withdrawInput = withdrawInput; this.getAccountDetailsInput = getAccountDetailsInput; this.closePresenter = closePresenter; this.depositPresenter = depositPresenter; this.withdrawPresenter = withdrawPresenter; this.getAccountDetailsPresenter = getAccountDetailsPresenter; }
public WithdrawAlert(double totalEfectivo, bool cancel) { _withdrawPresenter = new WithdrawPresenter(new WithdrawServices()); _totalEfectivo = totalEfectivo; InitializeComponent(); }