Exemplo n.º 1
0
        public void CalcRepo_AddTwoNumbers_ShouldReturnCorrectDouble()
        {
            // Arrange
            CalculatorRepository repo = new CalculatorRepository();

            // Act
            double actual   = repo.Add(7, 5);
            double expected = 12;

            // Assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        private void Add()
        {
            Console.Write("Enter the first number you want to add: ");
            double firstNum = ParseInput();

            Console.Write("Enter the second number you want to add: ");
            double secondNum = ParseInput();

            double sum = _calculator.Add(firstNum, secondNum);

            Console.WriteLine($"{firstNum} + {secondNum} = {sum}");
        }
Exemplo n.º 3
0
        public void CalcRepo_AddListOfNumbers_ShouldReturnCorrectDouble()
        {
            // Arrange
            CalculatorRepository repo       = new CalculatorRepository();
            List <double>        numberList = new List <double>();

            numberList.Add(7d);
            numberList.Add(2d);
            numberList.Add(3d);
            numberList.Add(4d);
            numberList.Add(3.25d);
            numberList.Add(1d);

            // Act
            double expected = 20.25;
            double actual   = repo.Add(numberList);

            // Assert
            Assert.AreEqual(expected, actual);
        }