コード例 #1
0
        /// <summary>
        /// Adds metrics to the report
        /// </summary>
        /// <param name="methodMetrics">The method metrics.</param>
        public void MetricsTable(IEnumerable <MethodMetric> methodMetrics)
        {
            if (methodMetrics == null)
            {
                throw new ArgumentNullException(nameof(methodMetrics));
            }

            foreach (var methodMetric in methodMetrics.OrderBy(c => c.Line))
            {
                this.reportTextWriter.WriteStartElement("Element");
                this.reportTextWriter.WriteAttributeString("name", XmlRenderer.ReplaceNonLetterChars(methodMetric.ShortName));

                foreach (var m in methodMetric.Metrics)
                {
                    this.reportTextWriter.WriteStartElement(XmlRenderer.ReplaceNonLetterChars(m.Name));
                    if (m.Value.HasValue)
                    {
                        this.reportTextWriter.WriteValue(m.Value.Value.ToString(CultureInfo.InvariantCulture));
                    }

                    this.reportTextWriter.WriteEndElement();
                }

                this.reportTextWriter.WriteEndElement();
            }

            this.reportTextWriter.WriteEndElement();
        }
コード例 #2
0
        /// <summary>
        /// Adds a table row with two cells to the report.
        /// </summary>
        /// <param name="key">The text of the first column.</param>
        /// <param name="files">The files.</param>
        public void KeyValueRow(string key, IEnumerable <string> files)
        {
            if (files == null)
            {
                throw new ArgumentNullException(nameof(files));
            }

            this.reportTextWriter.WriteStartElement(XmlRenderer.ReplaceNonLetterChars(key));

            foreach (var file in files)
            {
                this.reportTextWriter.WriteStartElement("File");
                this.reportTextWriter.WriteValue(file);
                this.reportTextWriter.WriteEndElement();
            }

            this.reportTextWriter.WriteEndElement();
        }
コード例 #3
0
 /// <summary>
 /// Adds a header to the report.
 /// </summary>
 /// <param name="text">The text.</param>
 public void Header(string text)
 {
     this.reportTextWriter.WriteStartElement(XmlRenderer.ReplaceNonLetterChars(text));
 }
コード例 #4
0
 /// <summary>
 /// Adds a table row with two cells to the report.
 /// </summary>
 /// <param name="key">The text of the first column.</param>
 /// <param name="value">The text of the second column.</param>
 public void KeyValueRow(string key, string value)
 {
     this.reportTextWriter.WriteStartElement(XmlRenderer.ReplaceNonLetterChars(key));
     this.reportTextWriter.WriteValue(value);
     this.reportTextWriter.WriteEndElement();
 }