private void HandleExceptionDuringTestMethod(TestFixture testFixture, MethodInfo methodInfo, Type exceptionType, Exception exception) { if ((exceptionType != null && exception.InnerException != null && exception.InnerException.GetType() != exceptionType)) { testFixture.Failed(string.Format("Unexpected exception expected {0} but was {1}... {2}", exceptionType.Name, exception.InnerException.GetType().Name, exception.Message)); } else if (exceptionType != null && exception.InnerException != null && exception.InnerException.GetType() == exceptionType) { testFixture.Passed(methodInfo.Name); } else { testFixture.Failed(string.Format("Unexpected {0}... {1}", exception.GetType().Name, exception.Message)); } }
private void SetFixtureToFailed(string methodName, TestFixture testFixture, Exception exception) { testFixture.SetClassName(testFixture.GetType().Name); testFixture.SetMethodName(methodName); testFixture.Failed("An exception occured during " + methodName + "..." + exception.Message); }
private void FailTestOnExpectedExceptionNotThrown(TestFixture testFixture, Type exceptionType) { if (exceptionType != null) testFixture.Failed("Expected exception of type " + exceptionType.ToString()); }