< Summary

Class:Azure.DigitalTwins.Core.QueryResult
Assembly:Azure.DigitalTwins.Core
File(s):C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Customized\Models\QueryResult.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Customized\Models\QueryResult.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Generated\Models\QueryResult.cs
Covered lines:19
Uncovered lines:5
Coverable lines:24
Total lines:100
Line coverage:79.1% (19 of 24)
Covered branches:11
Total branches:12
Branch coverage:91.6% (11 of 12)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_ContinuationToken()-100%100%
.ctor(...)-100%100%
get_Items()-100%100%
.ctor()-0%100%
DeserializeQueryResult(...)-92.86%91.67%
.ctor()-0%100%
.ctor(...)-100%100%
get_ContinuationToken()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Customized\Models\QueryResult.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using Azure.Core;
 6
 7namespace Azure.DigitalTwins.Core
 8{
 9    [CodeGenModel("QueryResult")]
 10    internal partial class QueryResult
 11    {
 12        // This class declaration makes the generated class of the same name use IReadOnlyList<string> instead of IReadO
 13        // makes the class internal,  and changes the namespace; do not remove.
 14
 15        /// <summary> The query results. </summary>
 416        internal IReadOnlyList<string> Items { get; }
 017    }
 18}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Customized\Models\QueryResult.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using System.Text.Json;
 6using Azure.Core;
 7
 8namespace Azure.DigitalTwins.Core
 9{
 10    internal partial class QueryResult
 11    {
 12        // This class declaration makes the generated class of the same name internal instead of public; do not remove.
 13        // It also overrides deserialization implementation in order to treat the **object** type definition for "items"
 14
 15        internal static QueryResult DeserializeQueryResult(JsonElement element)
 16        {
 417            IReadOnlyList<string> items = default;
 418            string continuationToken = default;
 2419            foreach (var property in element.EnumerateObject())
 20            {
 821                if (property.NameEquals("items"))
 22                {
 423                    if (property.Value.ValueKind == JsonValueKind.Null)
 24                    {
 25                        continue;
 26                    }
 427                    List<string> array = new List<string>();
 12028                    foreach (var item in property.Value.EnumerateArray())
 29                    {
 30                        // manual change: get json text
 5631                        array.Add(item.GetRawText());
 32                    }
 433                    items = array;
 434                    continue;
 35                }
 436                if (property.NameEquals("continuationToken"))
 37                {
 438                    if (property.Value.ValueKind == JsonValueKind.Null)
 39                    {
 40                        continue;
 41                    }
 042                    continuationToken = property.Value.GetString();
 43                    continue;
 44                }
 45            }
 446            return new QueryResult(items, continuationToken);
 47        }
 48    }
 49}

C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\Generated\Models\QueryResult.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using Azure.Core;
 10
 11namespace Azure.DigitalTwins.Core
 12{
 13    /// <summary> The results of a query operation and an optional continuation token. </summary>
 14    internal partial class QueryResult
 15    {
 16        /// <summary> Initializes a new instance of QueryResult. </summary>
 017        internal QueryResult()
 18        {
 019            Items = new ChangeTrackingList<string>();
 020        }
 21
 22        /// <summary> Initializes a new instance of QueryResult. </summary>
 23        /// <param name="items"> The query results. </param>
 24        /// <param name="continuationToken"> A token which can be used to construct a new QuerySpecification to retrieve
 225        internal QueryResult(IReadOnlyList<string> items, string continuationToken)
 26        {
 227            Items = items;
 228            ContinuationToken = continuationToken;
 229        }
 30        /// <summary> A token which can be used to construct a new QuerySpecification to retrieve the next set of result
 231        public string ContinuationToken { get; }
 32    }
 33}