예제 #1
0
        public void ShouldReturnTransactionSummary()
        {
            double balance = 1000;
            Atm    atm     = new Atm(balance);

            Assert.Equal("Starting balance is 1000\nEnding balance is 1000", atm.Summary());
        }
예제 #2
0
        public void ShouldNotHandleNegativeMoney()
        {
            double balance = 1000;
            Atm    atm     = new Atm(balance);

            Assert.Throws <Exception>(() => atm.AddMoney(-500));
        }
예제 #3
0
        public void ShouldThrowIfWithdrawOverCurrentBalance()
        {
            double balance = 400;
            Atm    atm     = new Atm(balance);

            Assert.Throws <Exception>(() => atm.WithdrawMoney(500));
        }
예제 #4
0
        public void ShouldReturnCorrectBalance()
        {
            double expected = 1000;

            Atm atm = new Atm(expected);

            Assert.Equal(expected, atm.ViewBalance());
        }
예제 #5
0
        public void ShouldReturnTransactionSummary2()
        {
            double balance = 1000;
            Atm    atm     = new Atm(balance);

            atm.AddMoney(100);
            Assert.Equal("Starting balance is 1000\nDeposit: 100\nCurrent balance is 1100\nEnding balance is 1100", atm.Summary());
        }
예제 #6
0
        public void ShouldReturnZeroBalance()
        {
            double expected = 0;

            Atm atm = new Atm(0);

            Assert.Equal(expected, atm.ViewBalance());
        }
예제 #7
0
        public void ShouldAddMoney()
        {
            double balance         = 1000;
            double expectedBalance = 1500;
            Atm    atm             = new Atm(balance);

            atm.AddMoney(500);

            Assert.Equal(expectedBalance, atm.ViewBalance());
        }