public void FindNthRoot_numbernegative0008rootnegative3eps0001_negative02returned()
        {
            // Arrange.
            double number = -0.008;
            int    root   = -3;
            double eps    = 0.0001;

            // Act.
            MathAlgorithm.FindNthRoot(number, root, eps);
        }
        public void FindNthRoot_numbernegative0008root3eps00001_negative02returned()
        {
            // Arrange.
            double number   = -0.008;
            int    root     = 3;
            double eps      = 0.0001;
            double expected = -0.2000;

            // Act.
            double actual = MathAlgorithm.FindNthRoot(number, root, eps);

            actual = Math.Round(actual, 4);

            // Assert.
            Assert.IsTrue(Math.Abs(expected - actual) < eps);
        }
        public void FindNthRoot_number1root5eps00001_1returned()
        {
            // Arrange.
            double number   = 1;
            int    root     = 5;
            double eps      = 0.0001;
            double expected = 1;

            // Act.
            double actual = MathAlgorithm.FindNthRoot(number, root, eps);

            actual = Math.Round(actual, 4);

            // Assert.
            Assert.IsTrue(Math.Abs(actual - expected) < eps);
        }
 public void FindNthRoot_ThrowsArgumentException(double a, int n, double eps)
 {
     Assert.Throws <ArgumentException>(
         () => MathAlgorithm.FindNthRoot(a, n, eps));
 }
 public void FindNthRoot(double a, int n, double eps)
 {
     Assert.IsTrue(Math.Abs(MathAlgorithm.FindNthRoot(a, n, eps) - Math.Pow(a, 1.0 / n)) < eps);
 }