< Summary

Class:Azure.Search.Documents.Models.AutocompleteResults
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\AutocompleteResults.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\AutocompleteResults.Serialization.cs
Covered lines:15
Uncovered lines:8
Coverable lines:23
Total lines:85
Line coverage:65.2% (15 of 23)
Covered branches:7
Total branches:10
Branch coverage:70% (7 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-100%100%
get_Coverage()-0%100%
get_Results()-100%100%
DeserializeAutocompleteResults(...)-83.33%87.5%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\AutocompleteResults.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;
 9using System.Collections.Generic;
 10using System.Linq;
 11
 12namespace Azure.Search.Documents.Models
 13{
 14    /// <summary> The result of Autocomplete query. </summary>
 15    public partial class AutocompleteResults
 16    {
 17        /// <summary> Initializes a new instance of AutocompleteResults. </summary>
 18        /// <param name="results"> The list of returned Autocompleted items. </param>
 19        /// <exception cref="ArgumentNullException"> <paramref name="results"/> is null. </exception>
 020        internal AutocompleteResults(IEnumerable<AutocompleteItem> results)
 21        {
 022            if (results == null)
 23            {
 024                throw new ArgumentNullException(nameof(results));
 25            }
 26
 027            Results = results.ToList();
 028        }
 29
 30        /// <summary> Initializes a new instance of AutocompleteResults. </summary>
 31        /// <param name="coverage"> A value indicating the percentage of the index that was considered by the autocomple
 32        /// <param name="results"> The list of returned Autocompleted items. </param>
 3233        internal AutocompleteResults(double? coverage, IReadOnlyList<AutocompleteItem> results)
 34        {
 3235            Coverage = coverage;
 3236            Results = results;
 3237        }
 38
 39        /// <summary> A value indicating the percentage of the index that was considered by the autocomplete request, or
 040        public double? Coverage { get; }
 41        /// <summary> The list of returned Autocompleted items. </summary>
 9642        public IReadOnlyList<AutocompleteItem> Results { get; }
 43    }
 44}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\AutocompleteResults.Serialization.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 System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Search.Documents.Models
 13{
 14    public partial class AutocompleteResults
 15    {
 16        internal static AutocompleteResults DeserializeAutocompleteResults(JsonElement element)
 17        {
 3218            Optional<double> searchCoverage = default;
 3219            IReadOnlyList<AutocompleteItem> value = default;
 12820            foreach (var property in element.EnumerateObject())
 21            {
 3222                if (property.NameEquals("@search.coverage"))
 23                {
 024                    searchCoverage = property.Value.GetDouble();
 025                    continue;
 26                }
 3227                if (property.NameEquals("value"))
 28                {
 3229                    List<AutocompleteItem> array = new List<AutocompleteItem>();
 24030                    foreach (var item in property.Value.EnumerateArray())
 31                    {
 8832                        array.Add(AutocompleteItem.DeserializeAutocompleteItem(item));
 33                    }
 3234                    value = array;
 35                    continue;
 36                }
 37            }
 3238            return new AutocompleteResults(Optional.ToNullable(searchCoverage), value);
 39        }
 40    }
 41}