internal bool RunIterate () { if (current != null) { if (!current.RunIterate ()) return false; CurrentCompleted (); } while (queue.Count > 0) { current = queue.Dequeue (); current.RunAsync (listener); if (!current.RunIterate ()) return false; CurrentCompleted (); } RunEnd (); return true; }
public override void RunAsync (TestListener listener) { IgnoreAttribute ignore = (IgnoreAttribute) Reflect.GetAttribute (Method, typeof (IgnoreAttribute)); this.listener = listener; tasks = new Queue<ConditionalHandler> (); Result = new TestResult (this); OnStarted (null); listener.TestStarted (this); is_async = Method.IsDefined (typeof (AsynchronousAttribute), false); Current = this; if (RunState == RunState.NotRunnable) { Result.Failure (IgnoreReason); } else if (ignore != null) { Result.NotRun (ignore.Reason); } else { SetUp (); try { RunTest (); if (is_async) { Suite.BeginInvoke (ProcessTasks); } else { Result.Success (); RunEnd (); } } catch (NUnitLiteException nex) { Result.RecordException (nex.InnerException); RunEnd (); } catch (Exception ex) { Result.RecordException (ex); RunEnd (); } } }
void RunEnd () { switch (Result.ResultState) { case ResultState.Error: ++Errors; break; case ResultState.Failure: ++Failures; break; case ResultState.NotRun: Result.Success (); break; default: break; } listener.TestFinished (Result); OnCompleted (null); // clear everything for the next test tasks.Clear (); Current = null; }
void RunEnd () { if (TestCaseCount == 0) Result.NotRun ("Class has no tests"); else if (Errors > 0 || Failures > 0) Result.Failure ("One or more component tests failed"); else Result.Success (); listener.TestFinished (Result); OnCompleted (null); current = null; }