本文整理汇总了C#中IReport.Sections方法的典型用法代码示例。如果您正苦于以下问题:C# IReport.Sections方法的具体用法?C# IReport.Sections怎么用?C# IReport.Sections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IReport
的用法示例。
在下文中一共展示了IReport.Sections方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTestResultHtml
private static string CreateTestResultHtml(IReport report)
{
var hasPassed = true;
foreach (var section in report.Sections().SelectMany(s => s.Sections()))
{
hasPassed = hasPassed && section.WasSuccessful;
if (!hasPassed)
{
break;
}
}
var template = hasPassed
? @"Sherlock.Shared.Core.Reporting.Templates.ReportResultPassedTemplate.html"
: @"Sherlock.Shared.Core.Reporting.Templates.ReportResultFailedTemplate.html";
return EmbeddedResourceExtracter.LoadEmbeddedTextFile(Assembly.GetExecutingAssembly(), template);
}
示例2: DetermineTestPassOrFail
private static string DetermineTestPassOrFail(IReport report)
{
var hasPassed = true;
foreach (var section in report.Sections().SelectMany(s => s.Sections()))
{
hasPassed = hasPassed && section.WasSuccessful;
if (!hasPassed)
{
break;
}
}
return hasPassed ? @"Passed" : @"Failed";
}
示例3: CreateReportSectionHtml
/// <summary>
/// Creates the HTML that describes a report section.
/// </summary>
/// <param name="report">The report that contains the report section information.</param>
/// <returns>A string containing the desired HTML.</returns>
private static string CreateReportSectionHtml(IReport report)
{
var sortedSections = new List<Tuple<DateTimeOffset, string, TestSection>>();
foreach (var reportSection in report.Sections())
{
foreach (var testSection in reportSection.Sections())
{
sortedSections.Add(new Tuple<DateTimeOffset, string, TestSection>(testSection.StartTime, reportSection.Name, testSection));
}
}
sortedSections.Sort((first, second) => first.Item1.CompareTo(second.Item1));
var builder = new StringBuilder();
{
int section = 0;
foreach (var pair in sortedSections)
{
var sectionText = CreateTestSectionHtml(pair.Item2, pair.Item3, section % 2 == 0);
builder.AppendLine(sectionText);
section++;
}
}
return builder.ToString();
}
示例4: CreateReportSectionXml
/// <summary>
/// Creates the XML that describes a report section.
/// </summary>
/// <param name="report">The report that contains the report section information.</param>
/// <returns>A string containing the desired XML.</returns>
private static string CreateReportSectionXml(IReport report)
{
var reportSectionTemplate = EmbeddedResourceExtracter.LoadEmbeddedTextFile(
Assembly.GetExecutingAssembly(),
@"Sherlock.Shared.Core.Reporting.Templates.ReportSectionTemplate.xml");
string reportSections = string.Empty;
foreach (var reportSection in report.Sections())
{
var testSections = CreateTestSectionXml(reportSection);
var builder = new StringBuilder(reportSectionTemplate);
{
builder.Replace(@"${REPORT_SECTION_NAME}$", EscapeTextForUseInXml(reportSection.Name));
builder.Replace(@"${TEST_SECTIONS}$", testSections);
}
reportSections += builder.ToString();
}
return reportSections;
}