public TestResult Run(TestListener listener) { int count = 0, failures = 0, errors = 0; listener.TestStarted(this); TestResult result = new TestResult(this); switch (this.RunState) { case RunState.NotRunnable: result.Error(this.IgnoreReason); break; case RunState.Ignored: result.NotRun(this.IgnoreReason); break; case RunState.Runnable: foreach (ITest test in tests) { ++count; TestResult r = test.Run(listener); result.AddResult(r); switch (r.ResultState) { case ResultState.Error: ++errors; break; case ResultState.Failure: ++failures; break; default: break; } } if (count == 0) { result.NotRun("Class has no tests"); } else if (errors > 0 || failures > 0) { result.Failure("One or more component tests failed"); } else { result.Success(); } break; } listener.TestFinished(result); return(result); }
protected virtual void Run(TestResult result, TestListener listener) { IgnoreAttribute ignore = (IgnoreAttribute)Reflect.GetAttribute(method, typeof(IgnoreAttribute)); if (this.RunState == RunState.NotRunnable) { result.Failure(this.ignoreReason); } else if (ignore != null) { result.NotRun(ignore.Reason); } else { try { RunBare(); result.Success(); } catch (NUnitLiteException nex) { result.RecordException(nex.InnerException); } #if !NETCF_1_0 catch (System.Threading.ThreadAbortException) { throw; } #endif catch (Exception ex) { result.RecordException(ex); } } }
public override void RunAsync (TestListener listener) { this.listener = listener; OnStarted (null); listener.TestStarted (this); Result = new TestResult (this); queue = new Queue<AsyncTestCase> (Tests.Count); switch (RunState) { case RunState.NotRunnable: Result.Error (IgnoreReason); break; case RunState.Ignored: Result.NotRun (IgnoreReason); break; case RunState.Runnable: foreach (AsyncTestCase @case in Tests) queue.Enqueue (@case); break; } }
protected virtual void Run(TestResult result, TestListener listener) { //this.method = GetMethod(this.Name, BindingFlags.Public | BindingFlags.Instance); IgnoreAttribute ignore = (IgnoreAttribute)Reflect.GetAttribute(method, typeof(IgnoreAttribute)); if (ignore != null) { result.NotRun(ignore.Reason); } else { try { RunBare(); result.Success(); } catch (NUnitLiteException nex) { result.RecordException(nex.InnerException); } #if !NETCF_1_0 catch (System.Threading.ThreadAbortException) { throw; } #endif catch (Exception ex) { result.RecordException(ex); } } }
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 (); } } }
protected virtual void Run(TestResult result, ITestListener listener) { IgnoreAttribute ignore = (IgnoreAttribute)Reflect.GetAttribute(method, typeof(IgnoreAttribute)); if (this.RunState == RunState.NotRunnable) result.Failure(this.ignoreReason); else if ( ignore != null ) result.NotRun(ignore.Reason); else { try { RunBare(); result.Success(); } catch (NUnitLiteException nex) { result.RecordException(nex.InnerException); } #if !NETCF_1_0 catch (System.Threading.ThreadAbortException) { throw; } #endif catch (Exception ex) { result.RecordException(ex); } } }
public TestResult Run(TestListener listener) { int count = 0, failures = 0, errors = 0; listener.TestStarted(this); TestResult result = new TestResult(this); switch (this.RunState) { case RunState.NotRunnable: result.Error(this.IgnoreReason); break; case RunState.Ignored: result.NotRun(this.IgnoreReason); break; case RunState.Runnable: foreach (ITest test in tests) { ++count; TestResult r = test.Run(listener); result.AddResult(r); switch (r.ResultState) { case ResultState.Error: ++errors; break; case ResultState.Failure: ++failures; break; default: break; } } if (count == 0) result.NotRun("Class has no tests"); else if (errors > 0 || failures > 0) result.Failure("One or more component tests failed"); else result.Success(); break; } listener.TestFinished(result); return result; }
public TestResult Run(TestListener listener) { int count = 0, failures = 0, errors = 0; listener.TestStarted(this); TestResult result = new TestResult(this); switch (this.RunState) { case RunState.NotRunnable: result.Error(this.IgnoreReason); break; case RunState.Ignored: result.NotRun(this.IgnoreReason); break; case RunState.Runnable: if(TestFixtureSetUpMethod != null) { NUnitLite.Reflect.InvokeMethod(TestFixtureSetUpMethod, TestObject); } foreach (ITest test in tests) { ++count; TestResult r = test.Run(listener); result.AddResult(r); switch (r.ResultState) { case ResultState.Error: ++errors; break; case ResultState.Failure: ++failures; break; default: break; } } if (TestFixtureTearDownMethod != null) { NUnitLite.Reflect.InvokeMethod(TestFixtureTearDownMethod, TestObject); } if (count == 0) { result.NotRun("Class has no tests"); } else if (errors > 0 || failures > 0) { result.Failure("One or more component tests failed"); } else { result.Success(); } break; } listener.TestFinished(result); return result; }
protected virtual void Run(TestResult result, TestListener listener) { //this.method = GetMethod(this.Name, BindingFlags.Public | BindingFlags.Instance); IgnoreAttribute ignore = (IgnoreAttribute)Reflect.GetAttribute(method, typeof(IgnoreAttribute)); if ( ignore != null ) result.NotRun(ignore.Reason); else { try { RunBare(); result.Success(); } catch (NUnitLiteException nex) { result.RecordException(nex.InnerException); } #if !NETCF_1_0 catch (System.Threading.ThreadAbortException) { throw; } #endif catch (Exception ex) { result.RecordException(ex); } } }