コード例 #1
0
        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);
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: Withdraw.xaml.cs プロジェクト: hiac0493/pos
 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);
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        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;
        }
コード例 #7
0
 public WithdrawAlert(double totalEfectivo, bool cancel)
 {
     _withdrawPresenter = new WithdrawPresenter(new WithdrawServices());
     _totalEfectivo     = totalEfectivo;
     InitializeComponent();
 }