public void Run() { if (FixtureRunner != null) { FixtureRunner.RunTests(this); } }
void Run() { Begin(); try { if (!Ignore) { if (StartUpMethod != null) { try { StartUpMethod.Invoke(Instance, null); } catch (TargetInvocationException tie) { Exception exp = tie.InnerException; foreach (ITest test in Tests) { test.Begin(); if (!test.Ignore) { test.Result.Message.AppendLine("Fixture set-up failed"); test.Result.SetFilteredStackTrace(exp.StackTrace); test.Result.WriteExceptionToMessage(exp); } else { test.Result.WriteIgnoreToMessage(test, test.IgnoreReason); } test.End(); } return; } } try { FixtureRunner.RunTests(this); } catch (Exception exp) { foreach (ITest test in Tests) { if (!test.Ignore) { test.Result.Message.AppendLine("Fixture runner failed"); test.Result.WriteExceptionToOutput(exp); if (test.Result.Status == TestStatus.Untested) { test.Begin(); test.Result.StackTrace = exp.StackTrace; test.End(); } } else if (test.Result.Status == TestStatus.Untested) { test.Begin(); test.Result.WriteIgnoreToMessage(test, test.IgnoreReason); test.End(); } } } if (TearDownMethod != null) { try { TearDownMethod.Invoke(Instance, null); } catch (TargetInvocationException tie) { Exception exp = tie.InnerException; foreach (ITest test in Tests) { if (!test.Ignore) { test.Result.Message.AppendLine("Fixture tear-down failed"); test.Result.WriteExceptionToOutput(exp); } } } } } else { foreach (ITest test in Tests) { test.Begin(); test.Result.WriteIgnoreToMessage(test, IgnoreReason); test.End(); } } } finally { End(); } }