コード例 #1
0
        public void CalcRepo_DivideTwoNumbers_ShouldReturnCorrectDouble()
        {
            // Arrange
            CalculatorRepository repo = new CalculatorRepository();

            // Act
            double expected = repo.Divide(12.5, 5);
            double actual   = 2.5;

            // Assert
            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
ファイル: UnitTest1.cs プロジェクト: Babaseun/Week5-Project
        public void DivideByZero()
        {
            int firstValue = 4;
            int secondValue = 0;

            CalculatorRepository op = new CalculatorRepository();
           
 Assert.Throws<DivideByZeroException>(() => op.Divide(firstValue, secondValue));
            


        }
コード例 #3
0
        private void Divide()
        {
            Console.Write("Enter the first number: ");
            double firstNum = ParseInput();

            Console.Write("Enter the number you would like to divide the first by: ");
            double secondNum = ParseInput();

            double quotient = _calculator.Divide(firstNum, secondNum);

            Console.WriteLine($"{firstNum} / {secondNum} = {quotient}");
        }
コード例 #4
0
ファイル: UnitTest1.cs プロジェクト: Babaseun/Week5-Project
        public void Divide()
        {
            int firstValue = 4;
            int secondValue = 2;

            CalculatorRepository op = new CalculatorRepository();
            var result = op.Divide(firstValue, secondValue);


            Assert.Equal(2, result);


        }