< Summary

Class:Microsoft.Azure.ApplicationInsights.Query.Models.QueryResults
Assembly:Microsoft.Azure.ApplicationInsights.Query
File(s):C:\Git\azure-sdk-for-net\sdk\applicationinsights\Microsoft.Azure.ApplicationInsights.Query\src\Customized\Models\QueryResult.cs
C:\Git\azure-sdk-for-net\sdk\applicationinsights\Microsoft.Azure.ApplicationInsights.Query\src\Generated\Models\QueryResults.cs
Covered lines:0
Uncovered lines:21
Coverable lines:21
Total lines:115
Line coverage:0% (0 of 21)
Covered branches:0
Total branches:12
Branch coverage:0% (0 of 12)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\applicationinsights\Microsoft.Azure.ApplicationInsights.Query\src\Customized\Models\QueryResult.cs

#LineLine coverage
 1using Newtonsoft.Json;
 2using System.Collections.Generic;
 3using System.Linq;
 4
 5namespace Microsoft.Azure.ApplicationInsights.Query.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, object>> 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 })
 026                            .ToDictionary(entry => entry.Name, entry => entry.cell);
 27                    }
 028                }
 029            }
 30        }
 31
 032        public IDictionary<string, string> Render { get; set; }
 033        public IDictionary<string, object> Statistics { get; set; }
 34    }
 35}

C:\Git\azure-sdk-for-net\sdk\applicationinsights\Microsoft.Azure.ApplicationInsights.Query\src\Generated\Models\QueryResults.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.ApplicationInsights.Query.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Collections;
 16    using System.Collections.Generic;
 17    using System.Linq;
 18
 19    /// <summary>
 20    /// A query response.
 21    /// </summary>
 22    /// <remarks>
 23    /// Contains the tables, columns &amp; rows resulting from a query.
 24    /// </remarks>
 25    public partial class QueryResults
 26    {
 27        /// <summary>
 28        /// Initializes a new instance of the QueryResults class.
 29        /// </summary>
 030        public QueryResults()
 31        {
 32            CustomInit();
 033        }
 34
 35        /// <summary>
 36        /// Initializes a new instance of the QueryResults class.
 37        /// </summary>
 38        /// <param name="tables">The list of tables, columns and rows.</param>
 039        public QueryResults(IList<Table> tables)
 40        {
 041            Tables = tables;
 42            CustomInit();
 043        }
 44
 45        /// <summary>
 46        /// An initialization method that performs custom operations like setting defaults
 47        /// </summary>
 48        partial void CustomInit();
 49
 50        /// <summary>
 51        /// Gets or sets the list of tables, columns and rows.
 52        /// </summary>
 53        [JsonProperty(PropertyName = "tables")]
 054        public IList<Table> Tables { get; set; }
 55
 56        /// <summary>
 57        /// Validate the object.
 58        /// </summary>
 59        /// <exception cref="ValidationException">
 60        /// Thrown if validation fails
 61        /// </exception>
 62        public virtual void Validate()
 63        {
 064            if (Tables == null)
 65            {
 066                throw new ValidationException(ValidationRules.CannotBeNull, "Tables");
 67            }
 068            if (Tables != null)
 69            {
 070                foreach (var element in Tables)
 71                {
 072                    if (element != null)
 73                    {
 074                        element.Validate();
 75                    }
 76                }
 77            }
 078        }
 79    }
 80}