Exemple #1
0
        static void Main(string[] args)
        {
            IBasicCalculator ibc = new BasicCalculator();

            for (int i = 0; ; i++)
            {
                Console.WriteLine("Enter Your Choice:");
                Console.WriteLine("1.Press '+' for Addition.");
                Console.WriteLine("2.Press '-' for Addition.");
                Console.WriteLine("3.Press '*' for Addition.");
                Console.WriteLine("4.Press '/' for Addition.");

                string choice;

                choice = Console.ReadLine();
                switch (choice)
                {
                case "+":
                    ibc.Addition();
                    break;

                case "-":
                    ibc.Subtraction();
                    break;

                case "*":
                    ibc.Multiplication();
                    break;

                case "/":
                    ibc.Division();
                    break;
                }
            }
        }
Exemple #2
0
        public void AdditionTest()
        {
            var response = calculator.Addition(3.2, 4.8);

            Assert.IsNotNull(response);
            Assert.AreEqual(8, response);
        }