예제 #1
0
        public void CanWithdrawAll(int initQty)
        {
            if (Acceptable(initQty))
            {
                AtmClient atm = Refill(initQty);

                atm.Withdraw(atm.AvailableAmount()).AvailableAmount().Should().Be(0);
            }
        }
예제 #2
0
        public void CanWithdraw(int initQty, int withdrawQty)
        {
            if (Acceptable(initQty) && withdrawQty > 0 && withdrawQty < 20)
            {
                AtmClient atm = Refill(initQty);

                if (withdrawQty > initQty)
                {
                    var initial = atm.AvailableAmount();
                    atm.Withdraw(Total(withdrawQty)).AvailableAmount().Should().Be(initial);
                }
                else
                {
                    var initial   = atm.AvailableAmount();
                    var withdrawn = Total(withdrawQty);
                    atm.Withdraw(withdrawn).AvailableAmount().Should().Be(initial - withdrawn);
                }
            }
        }