Beispiel #1
0
        public async Task Withdraw_Valid_Amount(
            MangaContext context,
            Guid accountId,
            double amount,
            double expectedBalance)
        {
            var presenter = new Presenter();

            var accountRepository = new AccountRepository(context);
            var unitOfWork        = new UnitOfWork(context);

            var sut = new Withdraw(
                presenter,
                accountRepository,
                unitOfWork
                );

            await sut.Execute(new Input(
                                  accountId,
                                  new PositiveAmount(amount)));

            var actual = presenter.Withdrawals.First();

            Assert.Equal(expectedBalance, actual.UpdatedBalance);
        }
Beispiel #2
0
        public void ExecuteTest3()
        {
            Client      client      = new Client("Jan", "Nowak", "01234567891");
            BankAccount bankAccount = new BankAccount("1", new InterestZero(), 1000, client);
            Withdraw    withdraw    = new Withdraw(bankAccount, -10);

            withdraw.Execute();
        }
Beispiel #3
0
    public static void DoWithdraw(Account account)
    {
        Console.WriteLine("How much you would like to withdraw?");
        Withdraw withdraw = new Withdraw(account, Convert.ToDecimal(Console.ReadLine()));

        withdraw.Execute();
        withdraw.Print();
    }
Beispiel #4
0
        public void ExecuteTest()
        {
            Client      client      = new Client("Jan", "Nowak", "01234567891");
            BankAccount bankAccount = new BankAccount("1", new InterestZero(), 1000, client);
            Withdraw    withdraw    = new Withdraw(bankAccount, 100);

            withdraw.Execute();

            Assert.AreEqual(900, bankAccount.GetSaldo());
        }
Beispiel #5
0
 public bool PerformTransfer()
 {
     _theWithdraw = new Withdraw(_fromAccount, _amount);
     _theWithdraw.Execute();
     Success = _theWithdraw.Success;
     if (Success)
     {
         _theDeposit = new Deposit(_toAccount, _amount);
         _theDeposit.Execute();
         Success = _theDeposit.Success;
         if (!Success)
         {
             _theDeposit = new Deposit(_fromAccount, _amount);
             _theDeposit.Execute();
         }
     }
     return(Success);
 }
Beispiel #6
0
        public async Task Withdraw_Valid_Amount(
            decimal amount,
            decimal expectedBalance)
        {
            var presenter = new WithdrawPresenter();
            var sut       = new Withdraw(
                _fixture.AccountService,
                presenter,
                _fixture.AccountRepository,
                _fixture.UnitOfWork);

            await sut.Execute(new WithdrawInput(
                                  _fixture.Context.DefaultAccountId,
                                  new PositiveMoney(amount)));

            var actual = presenter.Withdrawals.Last();

            Assert.Equal(expectedBalance, actual.UpdatedBalance.ToDecimal());
        }
        public async Task Withdraw_Valid_Amount(
            double amount,
            double expectedBalance)
        {
            var sut = new Withdraw(
                _fixture.EntityFactory,
                _fixture.Presenter,
                _fixture.AccountRepository,
                _fixture.UnitOfWork
                );

            await sut.Execute(new WithdrawInput(
                                  _fixture.Context.DefaultAccountId,
                                  new PositiveAmount(amount)));

            var actual = _fixture.Presenter.Withdrawals.Last();

            Assert.Equal(expectedBalance, actual.UpdatedBalance);
        }
        public async Task Withdraw_Valid_Amount(string accountId, double amount)
        {
            var presenter         = new Presenter();
            var context           = new MangaContext();
            var accountRepository = new AccountRepository(context);

            var sut = new Withdraw(
                presenter,
                accountRepository
                );

            await sut.Execute(new Input(
                                  Guid.Parse(accountId),
                                  new PositiveAmount(amount)));

            var actual = presenter.Withdrawals.First();

            Assert.Equal(3900, actual.UpdatedBalance);
        }