public void On0Returns1() { var mathLib = new FunctionalFactorial(); var result = mathLib.Factorial(0); Assert.Equal(1, result); }
public void On13Returns6227020800() { var mathLib = new FunctionalFactorial(); var result = mathLib.Factorial(13); Assert.Equal(6227020800, result); }
public void On10Returns3628800() { var mathLib = new FunctionalFactorial(); var result = mathLib.Factorial(10); Assert.Equal(3628800, result); }
public void On3Returns6() { var mathLib = new FunctionalFactorial(); var result = mathLib.Factorial(3); Assert.Equal(6, result); }
public void One2Returns2() { var mathLib = new FunctionalFactorial(); var result = mathLib.Factorial(2); Assert.Equal(2, result); }
public IMathLib GetMathLib(FactorialAlgorithm factorialAlgorithm) { IFactorialStrategy strategy; switch (factorialAlgorithm) { case FactorialAlgorithm.Functional: strategy = new FunctionalFactorial(); break; case FactorialAlgorithm.Recursional: strategy = new RecursiveFactorial(); break; default: throw new NotSupportedException(string.Format(Resources.Err_FactorialAlgorithmNotSupported, factorialAlgorithm)); } return(new MathLib(strategy)); }
public void OnMinus1ThrowsException() { var mathLib = new FunctionalFactorial(); var exception = Assert.Throws <ArgumentException>(() => mathLib.Factorial(-1)); }