private static bool RunTestMethod(Type implementationType, MethodInfo testMethod, bool printError) { Func <IWordsStatistics> createImpl = () => (IWordsStatistics)Activator.CreateInstance(implementationType); var testObj = new WordsStatistics_Tests { createStat = createImpl }; testObj.SetUp(); var timeout = GetTimeout(testMethod); try { Action test = () => testMethod.Invoke(testObj, new object[0]); if (timeout > 0) { RunTestOnOwnThread(timeout, test); } else { test(); } } catch (Exception e) { if (printError) { Console.WriteLine(e.InnerException); } return(false); } return(true); }
private static bool RunTestMethod(Type implementationType, MethodInfo testMethod, bool printError) { Func<IWordsStatistics> createImpl = () => (IWordsStatistics)Activator.CreateInstance(implementationType); var testObj = new WordsStatistics_Tests { createStat = createImpl }; testObj.SetUp(); var timeout = GetTimeout(testMethod); try { Action test = () => testMethod.Invoke(testObj, new object[0]); if (timeout > 0) RunTestOnOwnThread(timeout, test); else test(); } catch (Exception e) { if (printError) Console.WriteLine(e.InnerException); return false; } return true; }