Exemple #1
0
        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);
                }
            }
        }
Exemple #2
0
        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);
                }
            }
        }
Exemple #5
0
        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);
                }
            }
        }