public void RunTest(TestMethod test) { TestEventArgs <TTestMethod> args = new TestEventArgs <TTestMethod> { Test = test, TestRunner = this, Tag = Tag, Assembly = test.Method.DeclaringType.Assembly }; FireEvent(TestStarting, args); try { InvokeTest(test, IsolateMethodCalls); TestSummary.PassedTests.Add(test); FireEvent(TestPassed, args); } catch (ReflectionTypeLoadException rtle) { Exception ex = new ReflectionTypeLoadAggregateException(rtle); TestSummary.FailedTests.Add(new FailedTest { Test = test, Exception = ex }); FireEvent(TestFailed, new TestExceptionEventArgs(test, ex)); } catch (Exception ex) { ex = ex.GetInnerException(); TestSummary.FailedTests.Add(new FailedTest { Test = test, Exception = ex }); FireEvent(TestFailed, new TestExceptionEventArgs(test, ex)); } FireEvent(TestFinished, args); }
public static void Interactive() { try { IsInteractive = true; AddMenu(Assembly.GetEntryAssembly(), "Main", 'm', new ConsoleMenuDelegate(ShowMenu)); AddMenu(Assembly.GetEntryAssembly(), "Test", 't', new ConsoleMenuDelegate(UnitTestMenu)); ShowMenu(Assembly.GetEntryAssembly(), OtherMenus.ToArray(), "Main"); } catch (Exception ex) { if (ex is ReflectionTypeLoadException typeLoadEx) { ex = new ReflectionTypeLoadAggregateException(typeLoadEx); } OutLine(ex.Message); OutLine(ex.StackTrace); throw; } }