Example #1
0
        private void RooterOneValue(Rooter rooter, double expectedResult)
        {
            double input        = expectedResult * expectedResult;
            double actualResult = rooter.SquareRoot(input);

            Assert.AreEqual(expectedResult, actualResult, delta: expectedResult / 1000);
        }
Example #2
0
        public void RooterTestNegativeInputx()
        {
            Rooter rooter = new Rooter();

            try
            {
                rooter.SquareRoot(-10);
            }
            catch (ArgumentOutOfRangeException e)
            {
                return;
            }
            Assert.Fail();
        }
Example #3
0
        public void BasicRooterTest()
        {
            //instance to test
            Rooter rooter = new Rooter();

            //initialize test variable
            double expectedResult = 2.0;

            double input = expectedResult * expectedResult;

            //run method under test
            double actualResult = rooter.SquareRoot(input);

            // Verify the result:
            Assert.AreEqual(expectedResult, actualResult,
                            delta: expectedResult / 100);
        }