Exemple #1
0
        /// <summary>
        /// Set the test result based on the type of exception thrown
        /// </summary>
        /// <param name="ex">The exception that was thrown</param>
        public void RecordException(Exception ex)
        {
            if (ex is TCLiteException)
            {
                ex = ex.InnerException;
            }

            if (ex is System.Threading.ThreadAbortException)
            {
                SetResult(ResultState.Cancelled, "Test cancelled by user", ex.StackTrace);
            }
            else if (ex is AssertionException)
            {
                SetResult(ResultState.Failure, ex.Message, StackFilter.DefaultFilter.Filter(ex.StackTrace));
            }
            else if (ex is IgnoreException)
            {
                SetResult(ResultState.Ignored, ex.Message, StackFilter.DefaultFilter.Filter(ex.StackTrace));
            }
            else if (ex is InconclusiveException)
            {
                SetResult(ResultState.Inconclusive, ex.Message, StackFilter.DefaultFilter.Filter(ex.StackTrace));
            }
            else if (ex is SuccessException)
            {
                SetResult(ResultState.Success, ex.Message, StackFilter.DefaultFilter.Filter(ex.StackTrace));
            }
            else
            {
                SetResult(ResultState.Error,
                          ExceptionHelper.BuildMessage(ex),
                          ExceptionHelper.BuildStackTrace(ex));
            }
        }
Exemple #2
0
 /// <summary>
 /// Construct a non-runnable ParameterSet, specifying
 /// the provider exception that made it invalid.
 /// </summary>
 public TestParameters(Exception exception)
 {
     this.RunState = RunState.NotRunnable;
     this.Properties.Set(PropertyNames.SkipReason, ExceptionHelper.BuildMessage(exception));
     this.Properties.Set(PropertyNames.ProviderStackTrace, ExceptionHelper.BuildStackTrace(exception));
 }