コード例 #1
0
        private IEnumerable <TestReportItem> VisitTestResult(TestResult testResult)
        {
            var result = new List <TestReportItem>();

            if (testResult.Test.TestType == "TestMethod")
            {
                var reportItem = new TestReportItem()
                {
                    Name    = testResult.FullName,
                    Success = testResult.IsSuccess || (!testResult.IsError && !testResult.IsFailure)
                };

                if (!testResult.IsSuccess)
                {
                    reportItem.Message    = testResult.Message;
                    reportItem.StackTrace = testResult.StackTrace;
                }

                result.Add(reportItem);
            }
            else
            {
                if (testResult.Results != null)
                {
                    foreach (TestResult childTestResult in testResult.Results)
                    {
                        result.AddRange(VisitTestResult(childTestResult));
                    }
                }
            }

            return(result);
        }
コード例 #2
0
 public string CreateTestReportItemPart(TestReportItem item, int index)
 {
     return(string.Format(
                ItemHtmlTemplate,
                index % 2 == 0 ? "even" : "odd",
                item.Name,
                item.Time,
                item.Success ? "Yes" : "No",
                item.Message,
                item.StackTrace
                ));
 }