/// <summary> /// Adds the coverage information of an assembly to the report. /// </summary> /// <param name="assembly">The assembly.</param> public void SummaryAssembly(Assembly assembly) { string row = string.Format( CultureInfo.InvariantCulture, @"\textbf{{{0}}} & \textbf{{{1}\%}}\\", EscapeLatexChars(assembly.Name), assembly.CoverageQuota); this.reportBuilder.AppendLine(row); }
/// <summary> /// Starts the generation of the report. /// </summary> public void CreateReport() { int numberOfClasses = 0; var assemblies = new List<Assembly>(); foreach (var assemblyName in this.parser.Assemblies()) { var assembly = new Assembly(assemblyName); var classes = this.parser.ClassesInAssembly(assemblyName); foreach (var className in classes) { var clazz = new Class(assembly.Name, className); assembly.AddClass(clazz); numberOfClasses++; } assemblies.Add(assembly); } logger.InfoFormat("Analyzing {0} classes", numberOfClasses); int counter = 0; if (this.rendererFactory.SupportsParallelClassReports) { Parallel.ForEach( assemblies, (assembly) => { Parallel.ForEach( assembly.Classes, (clazz) => { int current = Interlocked.Increment(ref counter); logger.InfoFormat( CultureInfo.InvariantCulture, " Creating report {0}/{1} (Assembly: {2}, Class: {3})", current, numberOfClasses, clazz.AssemblyName, clazz.Name); this.CreateClassReport(clazz); }); }); } else { foreach (var assembly in assemblies) { foreach (var clazz in assembly.Classes) { logger.DebugFormat( CultureInfo.InvariantCulture, " Creating report {0}/{1} (Assembly: {2}, Class: {3})", ++counter, numberOfClasses, clazz.AssemblyName, clazz.Name); this.CreateClassReport(clazz); } } } this.CreateSummary(assemblies); }
/// <summary> /// Adds the coverage information of an assembly to the report. /// </summary> /// <param name="assembly">The assembly.</param> public void SummaryAssembly(Assembly assembly) { this.reportBuilder.AppendFormat( CultureInfo.InvariantCulture, "<tr class=\"expanded\"><th><a href=\"#\" class=\"toggleClassesInAssembly\" title=\"Collapse/Expand classes\"> </a> {0} {1}</th><th title=\"{2}\">{3}%</th><td>{4}</td></tr>", WebUtility.HtmlEncode(assembly.Name), CreateAssemblyPopup(assembly), CoverageType.LineCoverage, assembly.CoverageQuota, CreateCoverageTable(assembly.CoverageQuota)); }
/// <summary> /// Builds a table containing information about an assembly. /// </summary> /// <param name="assembly">The assembly.</param> /// <returns>Table containing information about an assembly</returns> private static string CreateAssemblyPopup(Assembly assembly) { var stringBuilder = new StringBuilder(); stringBuilder.AppendLine("<a href=\"#\" class=\"toggleAssemblyDetails\" title=\"Show details of assembly\">Details</a>"); stringBuilder.AppendLine("<div class=\"detailspopup\">"); stringBuilder.AppendLine("<table class=\"overview\">"); stringBuilder.AppendLine("<colgroup>"); stringBuilder.AppendLine("<col width=\"130\" />"); stringBuilder.AppendLine("<col />"); stringBuilder.AppendLine("</colgroup>"); stringBuilder.AppendFormat("<tr><th>Classes:</th><td>{0}</td></tr>", assembly.Classes.Count()); stringBuilder.AppendFormat("<tr><th>Coverage:</th><td>{0}%</td></tr>", assembly.CoverageQuota); stringBuilder.AppendFormat("<tr><th>Covered lines:</th><td>{0}</td></tr>", assembly.CoveredLines); stringBuilder.AppendFormat("<tr><th>Coverable lines:</th><td>{0}</td></tr>", assembly.CoverableLines); stringBuilder.AppendFormat("<tr><th>Total lines:</th><td>{0}</td></tr>", assembly.TotalLines); stringBuilder.AppendLine("</table>"); stringBuilder.AppendLine("</div>"); return stringBuilder.ToString(); }
/// <summary> /// Adds the coverage information of an assembly to the report. /// </summary> /// <param name="assembly">The assembly.</param> public void SummaryAssembly(Assembly assembly) { var coverage = new XElement( "Assembly", new XAttribute("name", assembly.Name), new XAttribute("classes", assembly.Classes.Count()), new XAttribute("coverage", assembly.CoverageQuota), new XAttribute("coveredlines", assembly.CoveredLines), new XAttribute("coverablelines", assembly.CoverableLines), new XAttribute("totallines", assembly.TotalLines)); this.currentElement.Add(coverage); this.currentAssembly = coverage; }