< Summary

Class:Microsoft.Azure.OperationalInsights.Models.QueryResults
Assembly:Microsoft.Azure.OperationalInsights
File(s):C:\Git\azure-sdk-for-net\sdk\operationalinsights\Microsoft.Azure.OperationalInsights\src\Customized\Models\QueryResults.cs
C:\Git\azure-sdk-for-net\sdk\operationalinsights\Microsoft.Azure.OperationalInsights\src\Generated\Models\QueryResults.cs
Covered lines:7
Uncovered lines:16
Coverable lines:23
Total lines:118
Line coverage:30.4% (7 of 23)
Covered branches:0
Total branches:12
Branch coverage:0% (0 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Tables()-100%100%
Validate()-100%100%
get_Results()-33.33%0%
.ctor()-66.67%100%
get_Render()-100%100%
.ctor(...)-33.33%100%
get_Statistics()-100%100%
.ctor()-100%100%
.ctor(...)-0%100%
get_Tables()-100%100%
Validate()-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\operationalinsights\Microsoft.Azure.OperationalInsights\src\Customized\Models\QueryResults.cs

#LineLine coverage
 1using Newtonsoft.Json;
 2using System.Collections.Generic;
 3using System.Linq;
 4
 5namespace Microsoft.Azure.OperationalInsights.Models
 6{
 7    /// <summary>
 8    /// The query response. This currently only supports the thinned query
 9    /// response format.
 10    /// </summary>
 11    public partial class QueryResults
 12    {
 13        /// <summary>
 14        /// Enumerates over all rows in all tables.
 15        /// </summary>
 16        [JsonProperty(PropertyName = "results")]
 17        public IEnumerable<IDictionary<string, string>> Results
 18        {
 19            get
 20            {
 021                foreach (var table in Tables)
 22                {
 023                    foreach (var row in table.Rows)
 24                    {
 025                        yield return table.Columns.Zip(row, (column, cell) => new { column.Name, cell })
 226                            .ToDictionary(entry => entry.Name, entry => entry.cell);
 27                    }
 028                }
 229            }
 30        }
 31
 32        /// <summary>
 33        /// If requested, contains visualization information for the results. See https://dev.loganalytics.io/documentat
 34        /// </summary>
 1235        public IDictionary<string, string> Render { get; set; }
 36
 037        /// <summary>
 38        /// If requested, contains query statistics. See https://dev.loganalytics.io/documentation/Using-the-API/Request
 039        /// </summary>
 1240        public IDictionary<string, object> Statistics{ get; set; }
 41    }
 42}

C:\Git\azure-sdk-for-net\sdk\operationalinsights\Microsoft.Azure.OperationalInsights\src\Generated\Models\QueryResults.cs

#LineLine coverage
 1// <auto-generated>
 2// Code generated by Microsoft (R) AutoRest Code Generator.
 3// Changes may cause incorrect behavior and will be lost if the code is
 4// regenerated.
 5// </auto-generated>
 6
 7namespace Microsoft.Azure.OperationalInsights.Models
 8{
 9    using Microsoft.Rest;
 10    using Newtonsoft.Json;
 11    using System.Collections;
 12    using System.Collections.Generic;
 13    using System.Linq;
 14
 15    /// <summary>
 16    /// A query response.
 17    /// </summary>
 18    /// <remarks>
 19    /// Contains the tables, columns &amp; rows resulting from a query.
 20    /// </remarks>
 21    public partial class QueryResults
 22    {
 23        /// <summary>
 24        /// Initializes a new instance of the QueryResults class.
 25        /// </summary>
 226        public QueryResults()
 27        {
 28            CustomInit();
 229        }
 30
 31        /// <summary>
 32        /// Initializes a new instance of the QueryResults class.
 33        /// </summary>
 34        /// <param name="tables">The list of tables, columns and rows.</param>
 035        public QueryResults(IList<Table> tables)
 36        {
 037            Tables = tables;
 38            CustomInit();
 039        }
 40
 41        /// <summary>
 42        /// An initialization method that performs custom operations like setting defaults
 43        /// </summary>
 44        partial void CustomInit();
 45
 46        /// <summary>
 47        /// Gets or sets the list of tables, columns and rows.
 48        /// </summary>
 49        [JsonProperty(PropertyName = "tables")]
 1450        public IList<Table> Tables { get; set; }
 51
 52        /// <summary>
 53        /// Validate the object.
 54        /// </summary>
 55        /// <exception cref="ValidationException">
 56        /// Thrown if validation fails
 57        /// </exception>
 58        public virtual void Validate()
 59        {
 060            if (Tables == null)
 61            {
 062                throw new ValidationException(ValidationRules.CannotBeNull, "Tables");
 63            }
 064            if (Tables != null)
 65            {
 066                foreach (var element in Tables)
 67                {
 068                    if (element != null)
 69                    {
 070                        element.Validate();
 71                    }
 72                }
 73            }
 074        }
 75    }
 76}