public void Test_Add()
        {
            CalculatorOp cal    = new CalculatorOp();
            int          result = cal.Add(5, 4);

            Assert.AreEqual(9, result);
        }
        public void ShouldAddReurnNineWhenPassFiveandFour()
        {
            CalculatorOp sut    = new CalculatorOp();
            int          result = sut.Add(5, 4);

            Assert.AreEqual(9, result);
        }
        public void ShouldAddReurnNineWhenPassFiveandFour()
        {
            CalculatorOp sut    = new CalculatorOp();
            int          result = sut.Add(5, 4);

            Assert.That(result, Is.EqualTo(9));
        }
Пример #4
0
        public void addonetwoisthree()
        {
            //Act
            double result = sut.Add(1, 2);

            //assert
            Assert.AreEqual(3, result);
        }
Пример #5
0
        public void ShouldAddReturnNineWhenPassFiveandFour()
        {
            //Average
            CalculatorOp sut = new CalculatorOp();
            //Act
            int result = sut.Add(5, 4);

            //Assert
            Assert.AreEqual(9, result);
        }
Пример #6
0
        static void Main(string[] args)
        {
            char cont = '+';

            while (cont == '+')
            {
                double num1, num2, result;
                char   oper;
                Console.WriteLine("Enter First number");
                num1 = Convert.ToDouble(Console.ReadLine());

                Console.WriteLine("Enter operation +-*/");
                oper = Convert.ToChar(Console.ReadLine());

                Console.WriteLine("Enter Second number");
                num2 = Convert.ToDouble(Console.ReadLine());
                CalculatorOp CalculatorOp = new CalculatorOp();
                if (oper == '+')
                {
                    result = CalculatorOp.Add(num1, num2);
                    Console.WriteLine(num1 + " + " + num2 + " = " + result);
                }
                else if (oper == '-')
                {
                    result = CalculatorOp.Substract(num1, num2);
                    Console.WriteLine(num1 + " - " + num2 + " = " + result);
                }
                else if (oper == '*')
                {
                    result = CalculatorOp.Mult(num1, num2);
                    Console.WriteLine(num1 + " * " + num2 + " = " + result);
                }
                else if (oper == '/')
                {
                    result = CalculatorOp.Division(num1, num2);
                    Console.WriteLine(num1 + " / " + num2 + " = " + result);
                }
                else
                {
                    Console.WriteLine("Unknown operator");
                }
                Console.WriteLine("Continue? +/-");
                cont = Convert.ToChar(Console.ReadLine());
            }
        }