Пример #1
0
        public static void UserInput()
        {
            bool loop = true;

            while (loop)
            {
                Console.WriteLine("Please select from the following options.");
                Console.WriteLine("Press 1 to view balance");
                Console.WriteLine("Press 2 to withdraw money");
                Console.WriteLine("Press 3 to add money");
                Console.WriteLine("Press 4 to exit");
                string input = Console.ReadLine();
                if (input == "1")
                {
                    Console.WriteLine(atm.ViewBalance());
                }
                else if (input == "2")
                {
                    WithdrawMoney();
                }
                else if (input == "3")
                {
                    AddMoney();
                }
                else if (input == "4")
                {
                    loop = false;
                }
                else
                {
                    Console.WriteLine("Invalid Input");
                }
            }
            Console.WriteLine(atm.Summary());
        }
Пример #2
0
        public void ShouldReturnCorrectBalance()
        {
            double expected = 1000;

            Atm atm = new Atm(expected);

            Assert.Equal(expected, atm.ViewBalance());
        }
Пример #3
0
        public void ShouldReturnZeroBalance()
        {
            double expected = 0;

            Atm atm = new Atm(0);

            Assert.Equal(expected, atm.ViewBalance());
        }
Пример #4
0
        public void ShouldAddMoney()
        {
            double balance         = 1000;
            double expectedBalance = 1500;
            Atm    atm             = new Atm(balance);

            atm.AddMoney(500);

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