Factorial(int value) { if (value < 0) { throw new ArgumentOutOfRangeException("value", Properties.LocalStrings.ArgumentPositive); } return(FactorialAlgorithm.Factorial(value)); }
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)); }