/// <summary>
        /// Adds the coverage information of a single line of a file to the report.
        /// </summary>
        /// <param name="analysis">The line analysis.</param>
        public void LineAnalysis(LineAnalysis analysis)
        {
            if (analysis == null)
            {
                throw new ArgumentNullException("analysis");
            }

            string formattedLine = analysis.LineContent
                .Replace(((char)11).ToString(), "  ") // replace tab
                .Replace(((char)9).ToString(), "  ") // replace tab
                .Replace("~", " "); // replace '~' since this used for the \verb command

            formattedLine = ShortenString(formattedLine);

            string lineVisitStatus = "gray";

            if (analysis.LineVisitStatus == LineVisitStatus.Covered)
            {
                lineVisitStatus = "green";
            }
            else if (analysis.LineVisitStatus == LineVisitStatus.NotCovered)
            {
                lineVisitStatus = "red";
            }

            string row = string.Format(
                CultureInfo.InvariantCulture,
                @"\cellcolor{{{0}}} & {1} & \verb~{2}~ & \verb~{3}~\\",
                lineVisitStatus,
                analysis.LineVisitStatus != LineVisitStatus.NotCoverable ? analysis.LineVisits.ToString(CultureInfo.InvariantCulture) : string.Empty,
                analysis.LineNumber,
                formattedLine);

            this.reportBuilder.AppendLine(row);
        }
        /// <summary>
        /// Adds the coverage information of a single line of a file to the report.
        /// </summary>
        /// <param name="analysis">The line analysis.</param>
        public void LineAnalysis(LineAnalysis analysis)
        {
            if (analysis == null)
            {
                throw new ArgumentNullException("analysis");
            }

            var coverage = new XElement(
                "LineAnalysis",
                new XAttribute("line", analysis.LineNumber),
                new XAttribute("visits", analysis.LineVisits),
                new XAttribute("coverage", analysis.LineVisitStatus),
                new XAttribute("content", analysis.LineContent));

            this.currentFile.Add(coverage);
        }
        /// <summary>
        /// Adds the coverage information of a single line of a file to the report.
        /// </summary>
        /// <param name="analysis">The line analysis.</param>
        public void LineAnalysis(LineAnalysis analysis)
        {
            if (analysis == null)
            {
                throw new ArgumentNullException("analysis");
            }

            string formattedLine = analysis.LineContent
                .Replace(((char)11).ToString(), "  ") // replace tab
                .Replace(((char)9).ToString(), "  "); // replace tab

            if (formattedLine.Length > 120)
            {
                formattedLine = formattedLine.Substring(0, 120);
            }

            formattedLine = WebUtility.HtmlEncode(formattedLine);
            formattedLine = formattedLine.Replace(" ", "&nbsp;");

            string lineVisitStatus = "gray";

            if (analysis.LineVisitStatus == LineVisitStatus.Covered)
            {
                lineVisitStatus = "green";
            }
            else if (analysis.LineVisitStatus == LineVisitStatus.NotCovered)
            {
                lineVisitStatus = "red";
            }

            this.reportBuilder.AppendLine("<tr>");

            this.reportBuilder.AppendFormat(
                CultureInfo.InvariantCulture,
                "<td class=\"{0}\">&nbsp;</td>",
                lineVisitStatus);
            this.reportBuilder.AppendFormat(
                CultureInfo.InvariantCulture,
                "<td class=\"leftmargin right\">{0}</td>",
                analysis.LineVisitStatus != LineVisitStatus.NotCoverable ? analysis.LineVisits.ToString(CultureInfo.InvariantCulture) : string.Empty);
            this.reportBuilder.AppendFormat(
                CultureInfo.InvariantCulture,
                "<td class=\"right\"><code>{0}</code></td>",
                analysis.LineNumber);
            this.reportBuilder.AppendFormat(
                CultureInfo.InvariantCulture,
                "<td{0}><code>{1}</code></td>",
                analysis.LineVisitStatus == LineVisitStatus.NotCoverable ? " class=\"light\"" : string.Empty,
                formattedLine);

            this.reportBuilder.AppendLine("</tr>");
        }
 /// <summary>
 /// Adds the given line analysis to the file analysis.
 /// </summary>
 /// <param name="lineAnalysis">The line analysis.</param>
 public void AddLineAnalysis(LineAnalysis lineAnalysis)
 {
     this.lineAnalysis.Add(lineAnalysis);
 }