Ejemplo n.º 1
0
        public void AddMethod_AddTwoPositiveInts_ResultEqualsCorrectSum()
        {
            //Arrange
            AddMethod add      = new AddMethod();
            int       num1     = 1;
            int       num2     = 1;
            int       expected = 2;
            int       actual   = num1 + num2;

            //Act
            add.Add(num1, num2);

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 2
0
        public void AddMethod_AddOnePositveIntToOneNegativeInt_ResultEqualsCorrectSum()
        {
            //Arrange
            AddMethod add      = new AddMethod();
            int       posInt   = 2;
            int       negInt   = -1;
            int       expected = 1;
            int       actual   = posInt + negInt;

            //Act
            add.Add(posInt, negInt);

            //Assert
            Assert.AreEqual(expected, actual);
        }
Ejemplo n.º 3
0
        public static bool LogicLoop(bool continueRun)
        {
            //  Prompt user for action
            Console.WriteLine("Would you like to add a customer (add), delete a customer (delete), view all customers (view), or exit (exit)?");
            string programAction = Console.ReadLine();

            Console.WriteLine();

            //  Add, View, Delete, Exit
            if (programAction == "add" ||
                programAction == "Add")
            {
                //  Add method
                AddMethod.Add();
                return(continueRun);
            }
            else if (programAction == "view" ||
                     programAction == "View")
            {
                //  View method
                ViewMethod.View();
                return(continueRun);
            }
            else if (programAction == "delete" ||
                     programAction == "Delete")
            {
                //  Delete method
                DeleteMethod.Delete();
                return(continueRun);
            }
            else if (programAction == "exit" ||
                     programAction == "Exit")
            {
                //  Exit program
                continueRun = false;
                return(continueRun);
            }
            else
            {
                //  Show error, return to loop
                Console.WriteLine("Command not found.");
                Console.WriteLine();
                return(continueRun);
            }
        }