public void MultipleAfterTestExceptionsConvertedInReverseThrownOrder() { var afterExceptions = new Exception[3]; afterExceptions[0] = GenerateSingleException(); afterExceptions[1] = GenerateSingleException2(); afterExceptions[2] = GenerateSingleException3(); var exception = new AfterTestException(afterExceptions); var message = ExceptionUtility.GetMessage(exception); var stackTrace = ExceptionUtility.GetStackTrace(exception); string simplifiedMessage; var taskExceptions = ExceptionConverter.ConvertExceptions(exception.GetType().FullName, message, stackTrace, out simplifiedMessage); Assert.NotNull(taskExceptions); Assert.Equal(3, taskExceptions.Length); Assert.Equal(afterExceptions[0].GetType().FullName, taskExceptions[2].Type); Assert.Equal(afterExceptions[0].Message, taskExceptions[2].Message); Assert.Equal(afterExceptions[0].StackTrace, taskExceptions[2].StackTrace); Assert.Equal(afterExceptions[1].GetType().FullName, taskExceptions[1].Type); Assert.Equal(afterExceptions[1].Message, taskExceptions[1].Message); Assert.Equal(afterExceptions[1].StackTrace, taskExceptions[1].StackTrace); Assert.Equal(afterExceptions[2].GetType().FullName, taskExceptions[0].Type); Assert.Equal(afterExceptions[2].Message, taskExceptions[0].Message); Assert.Equal(afterExceptions[2].StackTrace, taskExceptions[0].StackTrace); // TODO: RS6 uses full exception name. Does previous versions? Assert.Equal("Xunit.Sdk.AfterTestException: One or more exceptions were thrown from After methods during test cleanup", simplifiedMessage); }
public void CanConvertSingleAfterTestException() { var afterExceptions = new Exception[1]; afterExceptions[0] = GenerateSingleException(); var exception = new AfterTestException(afterExceptions); string message = ExceptionUtility.GetMessage(exception); string stackTrace = ExceptionUtility.GetStackTrace(exception); string simplifiedMessage; TaskException[] taskExceptions = ExceptionConverter.ConvertExceptions(exception.GetType().FullName, message, stackTrace, out simplifiedMessage); Assert.NotNull(taskExceptions); Assert.Equal(1, taskExceptions.Length); Assert.Equal(afterExceptions[0].GetType().FullName, taskExceptions[0].Type); Assert.Equal(afterExceptions[0].Message, taskExceptions[0].Message); Assert.Equal(afterExceptions[0].StackTrace, taskExceptions[0].StackTrace); Assert.Equal("Xunit.Sdk.AfterTestException: One or more exceptions were thrown from After methods during test cleanup", simplifiedMessage); }