Exemple #1
0
        public void Withdraw_InsufficientCash_ReturnAtmError()
        {
            var atm = new Atm(0);

            atm.BeginSession(0, 0, 100, 100);
            var result = atm.WithdrawCash(100);

            Assert.AreEqual(result, "ATM_ERR");
        }
Exemple #2
0
        public void Withdraw_InsufficientBalance_ReturnFundsError(int balance, int overdraft, int withdrawalAmount)
        {
            var atm = new Atm(int.MaxValue);

            atm.BeginSession(0, 0, balance, overdraft);
            var result = atm.WithdrawCash(withdrawalAmount);

            Assert.AreEqual(result, "FUNDS_ERR");
        }
Exemple #3
0
        public void Withdraw_IncorrectPin_ReturnAccountError()
        {
            var atm = new Atm(int.MaxValue);

            atm.BeginSession(1111, 0, 1, 1);

            var result = atm.WithdrawCash(1);

            Assert.AreEqual(result, "ACCOUNT_ERR");
        }
Exemple #4
0
        public string Withdraw_HasSufficientBalance_returnRemainingBalance(int balance, int overdraft, int withdrawalAmount)
        {
            var atm = new Atm(int.MaxValue);

            atm.BeginSession(0, 0, balance, overdraft);
            var result = atm.WithdrawCash(withdrawalAmount);

            atm.EndSession();
            return(result);
        }
Exemple #5
0
        public void Balance_IncorrectPin_ReturnAccountError()
        {
            var atm = new Atm(int.MaxValue);

            atm.BeginSession(1111, 0, 1, 1);

            var result = atm.GetBalance();

            Assert.AreEqual(result, "ACCOUNT_ERR");
        }
Exemple #6
0
        public string Balance_CorrectPin_ReturnBalance(int balance)
        {
            var atm = new Atm(int.MaxValue);

            atm.BeginSession(1111, 1111, balance, 1);

            var result = atm.GetBalance();

            return(result);
        }
Exemple #7
0
        public void Withdraw_InsufficientBalance_BalanceUnchanged()
        {
            var atm = new Atm(int.MaxValue);

            atm.BeginSession(1111, 1111, 1, 0);

            atm.WithdrawCash(1000);

            Assert.AreEqual(atm.GetBalance(), "1");
        }
Exemple #8
0
        public void Withdraw_MultipleWithdrawals_ReturnRemainingBalance()
        {
            var atm = new Atm(int.MaxValue);

            atm.BeginSession(0, 0, 1000, 0);
            atm.WithdrawCash(10);

            var result = atm.WithdrawCash(10);

            Assert.AreEqual(result, "980");
        }
Exemple #9
0
        public void Withdraw_SufficientBalance_BalanceUpdated()
        {
            var atm = new Atm(int.MaxValue);

            atm.BeginSession(0, 0, 1, 0);
            atm.WithdrawCash(1);

            var result = atm.GetBalance();

            Assert.AreEqual(result, "0");
        }