Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.WriteLine("***CALCULATOR***");

            CheckIfProperInput.ShowMenu();

            int chosenMethod;

            do
            {
                chosenMethod = CheckIfProperInput.CheckIfItIsNumber();
            } while (chosenMethod == 0);

            while (chosenMethod < 0 || chosenMethod > 4)
            {
                Console.WriteLine(" ");
                Console.WriteLine("Choose the number from the list! One more chance: ");
                CheckIfProperInput.ShowMenu();
                chosenMethod = int.Parse(Console.ReadLine());
            }

            Console.Write("Type in first number: ");
            var num1 = double.Parse(Console.ReadLine());

            Console.Write("Type in second number: ");
            var num2 = double.Parse(Console.ReadLine());

            DoTheMath.Calculate(chosenMethod, num1, num2);
            Console.ReadLine();
        }
Esempio n. 2
0
        public void testDivisionTotal()
        {
            //arrange
            var x = new DoTheMath();

            x.performMath(1, 2, "divide");
            Assert.AreEqual(x.total, .5);
        }
Esempio n. 3
0
        public void testSubtractionTotal()
        {
            //arrange
            var x = new DoTheMath();

            x.performMath(1, 2, "subtract");
            Assert.AreEqual(x.total, -1);
        }
Esempio n. 4
0
        public void testMultiplicationTotal()
        {
            //arrange
            var x = new DoTheMath();

            x.performMath(1, 2, "multiply");
            Assert.AreEqual(x.total, 2);
        }
Esempio n. 5
0
        public void testAdditionTotal()
        {
            //arrange
            var x = new DoTheMath();

            x.performMath(1, 2, "add");
            Assert.AreEqual(x.total, 3);
        }