Пример #1
0
            protected override bool Visit(ITestFailed testFailed)
            {
                var testCase = testCases.Single(tc => tc.DisplayName == testFailed.TestCase.DisplayName);

                testCase.State = TestState.Failed;
                var resultString = new StringBuilder(testFailed.TestCase.DisplayName);

                resultString.AppendLine(" FAILED:");
                for (int i = 0; i < testFailed.ExceptionTypes.Length; i++)
                {
                    resultString.AppendLine($"\tException type: '{testFailed.ExceptionTypes[i]}', number: '{i}', parent: '{testFailed.ExceptionParentIndices[i]}'");
                    resultString.AppendLine($"\tException message:");
                    resultString.AppendLine(testFailed.Messages[i]);
                    resultString.AppendLine($"\tException stacktrace");
                    resultString.AppendLine(testFailed.StackTraces[i]);
                }
                resultString.AppendLine();

                TestFinished?.Invoke(this, TestStateEventArgs.Failed(resultString.ToString()));
                return(!isCancelRequested());
            }