Ejemplo n.º 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());
        }
Ejemplo n.º 2
0
        public void ShouldReturnTransactionSummary()
        {
            double balance = 1000;
            Atm    atm     = new Atm(balance);

            Assert.Equal("Starting balance is 1000\nEnding balance is 1000", atm.Summary());
        }
Ejemplo n.º 3
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());
        }