예제 #1
0
        public void CalculatorRepository_AddTwoNumbers_ShouldReturnCorrectSum()
        {
            //Act
            var actual   = _calcRepoTest.AddTwoNumbers(a, b);
            var expected = 12m;

            //Assert
            Assert.AreEqual(expected, actual);
        }
        public void TestMethod1()
        {
            CalculatorRepository calcRepo = new CalculatorRepository();

            int actual   = calcRepo.AddTwoNumbers(5, 5);
            int expected = 10;

            Assert.AreEqual(expected, actual);
        }
        public void CalculatorRepository_AddTwoNumbers_ShouldBeCorrectInt()
        {
            // Arrange
            CalculatorRepository calcRepo = new CalculatorRepository();

            // Act
            int actual = calcRepo.AddTwoNumbers(1, 1);

            // Assert
            Assert.AreEqual(2, actual);
        }
예제 #4
0
        public void TestMethod1()
        {
            Console.WriteLine("Please enter two numbers");
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            CalculatorRepository calcRepo = new CalculatorRepository();
            int actual   = calcRepo.AddTwoNumbers(a, b);
            int expected = 10;

            Assert.AreEqual(expected, actual);
        }
        public void Calculator_AddTwoNumbers_ShouldBeCorrectValue()
        {
            //Arrange
            CalculatorRepository calcRepo = new CalculatorRepository();

            //Act
            int actualValue = calcRepo.AddTwoNumbers(4, 3);
            int expected    = 7;

            //Assert
            Assert.AreEqual(expected, actualValue);
        }
예제 #6
0
        public void AddTwoNumbersUI()
        {
            Console.WriteLine("Enter the first number: ");
            string numberOneAsString = Console.ReadLine();
            int    numberOne         = int.Parse(numberOneAsString);

            Console.WriteLine("Enter the second number: ");
            string numberTwoAsString = Console.ReadLine();
            int    numberTwo         = int.Parse(numberTwoAsString);

            _mathRepo.AddTwoNumbers(numberOne, numberTwo);
        }
        public void Calculator_AddTwoNumbers_ShouldBeCorrectValue()
        {
            //Arrange
            //The following code tells the program that it is a
            // new value USING the CalculatorRepository.
            // This value is stored in RAM until overwritten by other "new"s

            CalculatorRepository calcRepo = new CalculatorRepository();

            //Act
            float actualValue = calcRepo.AddTwoNumbers(3, 4);
            float expected    = 7;

            //Assert
            Assert.AreEqual(expected, actualValue);
        }
        public void GetTwoNumbersFromUserAndPrintResultToUser()
        {
            Console.WriteLine("Please enter a number.");
            string firstUserInput = Console.ReadLine();
            int    numberOne      = int.Parse(firstUserInput);

            Console.WriteLine("Please enter another number.");
            string secondUserInput = Console.ReadLine();
            int    numberTwo       = int.Parse(secondUserInput);

            CalculatorRepository calcRepo = new CalculatorRepository();
            int result = calcRepo.AddTwoNumbers(numberOne, numberTwo);

            Console.WriteLine($"Your result is:  {result}");

            Console.ReadKey();
        }
 [TestMethod]         //NameOfProject_NameOfMethod_ExpectedResult
 public void CalculatorRepository_AddTwoNumbers_ShouldReturnCorrectInt()
 {
     Assert.AreEqual(4, calculatorRepo.AddTwoNumbers(2, 2));
 }