Esempio n. 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);
                }
            }
        }
Esempio n. 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);
                }
            }
        }
Esempio n. 3
0
		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 ();
				}
			}
		}
Esempio n. 4
0
        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);
                }
            }
        }
Esempio n. 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);
                }
            }
        }