Exemple #1
0
        public void RooterValueRange()
        {
            // Create an instance to test:
            Rooter rooter = new Rooter();

            // Try a range of values:
            for (double expectedResult = 1e-8;
                 expectedResult < 1e+8;
                 expectedResult = expectedResult * 3.2)
            {
                RooterOneValue(rooter, expectedResult);
            }
        }
        public void BasicRooterTest()
        {
            //Create an instance to test
            Rooter rooter = new Rooter();
            //Define a test input and ouput value
            double expectedResult = 2.0;
            double input          = expectedResult * expectedResult;
            //Run the method under test
            double actualResult = rooter.SquareRoot(input);

            //Verify the reslt
            Assert.AreEqual(expectedResult, actualResult, delta: expectedResult / 100);
        }
Exemple #3
0
        public void RooterTestNegativeInputx()
        {
            Rooter rooter = new Rooter();

            try
            {
                rooter.SquareRoot(-10);
            }
            catch (ArgumentOutOfRangeException e)
            {
                return;
            }
            Assert.Fail();
        }