public void FindNextBiggerNumber_NumberHavingTheNearestLargerInteger_ExpectedTheNearestLargerInteger() { var sourceNumber = Convert.ToInt32(TestContext.DataRow["sourceNumber"]); var expectedResult = Convert.ToInt32(TestContext.DataRow["expectedResult"]); var result = NumericalMathMethods.FindNextBiggerNumber(sourceNumber); Assert.AreEqual(result, expectedResult); }
public void FindNthRoot_CorrectNumber_TheNthRootOfASourceNumber( double number, int degree, double accuracy, double expectedResult) { Assert.True( Math.Abs(NumericalMathMethods.FindNthRoot(number, degree, accuracy) - expectedResult) < accuracy); }
public void FindNthRoot_CorrectNumber_TheNthRootOfASourceNumber() { double sourceNumber = Convert.ToDouble(TestContext.DataRow["sourceNumber"]); int degree = Convert.ToInt32(TestContext.DataRow["degree"]); double accuracy = Convert.ToDouble(TestContext.DataRow["accuracy"]); double expectedResult = Convert.ToDouble(TestContext.DataRow["expectedResult"]); Assert.IsTrue( Math.Abs(NumericalMathMethods.FindNthRoot(sourceNumber, degree, accuracy) - expectedResult) < accuracy); }
public void FindNthRoot_EvenDegreeAndNegativeNumber_ExpectedArgumentException( double number, int degree, double accuracy) => Assert.Throws <ArgumentException>(() => NumericalMathMethods.FindNthRoot(number, degree, accuracy));
public void FindNthRoot_NotPositiveAccuracy_ExpectedArgumentOutOfRangeException( double number, int degree, double accuracy) => Assert.Throws <ArgumentOutOfRangeException>( () => NumericalMathMethods.FindNthRoot(number, degree, accuracy));
public void FindNextBiggerNumber_NegativeNumber_ExpectedArgumentOutOfRangeException(int number) => Assert.Throws <ArgumentOutOfRangeException>(() => NumericalMathMethods.FindNextBiggerNumber(number));
public void FindNextBiggerNumber_NumberNotHavingTheNearestLargerInteger_ExpectedMinusOne(int number) { Assert.AreEqual(-1, NumericalMathMethods.FindNextBiggerNumber(number)); }
public int FindNextBiggerNumber_NumberHavingTheNearestLargerInteger_ExpectedTheNearestLargerInteger(int number) { return(NumericalMathMethods.FindNextBiggerNumber(number)); }
public void FindNthRoot_NegativeDegree_ExpectedArgumentOutOfRangeException( double number, int degree, double accuracy) => NumericalMathMethods.FindNthRoot(number, degree, accuracy);