Пример #1
0
		protected virtual void RecordException( Exception exception, TestResult testResult, FailureSite failureSite )
		{
            if (exception is NUnitException)
                exception = exception.InnerException;

            testResult.SetResult(NUnitFramework.GetResultState(exception), exception, failureSite);
		}
Пример #2
0
        protected virtual void RecordException(Exception exception, TestResult testResult)
        {
            if (exception is NUnitException)
            {
                exception = exception.InnerException;
            }

            testResult.SetResult(NUnitFramework.GetResultState(exception), exception);
        }
Пример #3
0
		protected virtual void RecordException( Exception exception, TestResult testResult, FailureSite failureSite )
		{
            if (exception is NUnitException)
                exception = exception.InnerException;

            // Ensure that once a test is cancelled, it stays cancelled
            ResultState finalResultState = testResult.ResultState == ResultState.Cancelled
                ? ResultState.Cancelled
                : NUnitFramework.GetResultState(exception);

            testResult.SetResult(finalResultState, exception, failureSite);
		}
        public void ProcessException(Exception exception, TestResult testResult)
        {
            if (exception is NUnitException)
            {
                exception = exception.InnerException;
            }

            if (IsExpectedExceptionType(exception))
            {
                if (IsExpectedMessageMatch(exception))
                {
                    if (exceptionHandler != null)
                    {
                        Reflect.InvokeMethod(exceptionHandler, testMethod.Fixture, exception);
                    }

                    testResult.Success();
                }
                else
                {
                    testResult.Failure(WrongTextMessage(exception), GetStackTrace(exception));
                }
            }
            else
            {
                switch (NUnitFramework.GetResultState(exception))
                {
                case ResultState.Failure:
                    testResult.Failure(exception.Message, exception.StackTrace);
                    break;

                case ResultState.Ignored:
                    testResult.Ignore(exception);
                    break;

                case ResultState.Inconclusive:
                    testResult.SetResult(ResultState.Inconclusive, exception, FailureSite.Test);
                    break;

                case ResultState.Success:
                    testResult.Success(exception.Message);
                    break;

                default:
                    testResult.Failure(WrongTypeMessage(exception), GetStackTrace(exception));
                    break;
                }
            }
        }