< Summary

Class:Azure.Search.Documents.Models.SuggestResult
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SuggestResult.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SuggestResult.Serialization.cs
Covered lines:0
Uncovered lines:31
Coverable lines:31
Total lines:99
Line coverage:0% (0 of 31)
Covered branches:0
Total branches:8
Branch coverage:0% (0 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_Text()-0%100%
get_AdditionalProperties()-0%100%
GetEnumerator()-0%100%
System.Collections.IEnumerable.GetEnumerator()-0%100%
TryGetValue(...)-0%100%
ContainsKey(...)-0%100%
get_Keys()-0%100%
get_Values()-0%100%
System.Collections.Generic.IReadOnlyCollection<System.Collections.Generic.KeyValuePair<System.String,System.Object>>.get_Count()-0%100%
get_Item(...)-0%100%
DeserializeSuggestResult(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SuggestResult.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;
 10using System.Collections.Generic;
 11using Azure.Core;
 12
 13namespace Azure.Search.Documents.Models
 14{
 15    /// <summary> A result containing a document found by a suggestion query, plus associated metadata. </summary>
 16    internal partial class SuggestResult : IReadOnlyDictionary<string, object>
 17    {
 18        /// <summary> Initializes a new instance of SuggestResult. </summary>
 19        /// <param name="text"> The text of the suggestion result. </param>
 20        /// <exception cref="ArgumentNullException"> <paramref name="text"/> is null. </exception>
 021        internal SuggestResult(string text)
 22        {
 023            if (text == null)
 24            {
 025                throw new ArgumentNullException(nameof(text));
 26            }
 27
 028            Text = text;
 029            AdditionalProperties = new ChangeTrackingDictionary<string, object>();
 030        }
 31
 32        /// <summary> Initializes a new instance of SuggestResult. </summary>
 33        /// <param name="text"> The text of the suggestion result. </param>
 34        /// <param name="additionalProperties"> . </param>
 035        internal SuggestResult(string text, IReadOnlyDictionary<string, object> additionalProperties)
 36        {
 037            Text = text;
 038            AdditionalProperties = additionalProperties;
 039        }
 40
 41        /// <summary> The text of the suggestion result. </summary>
 042        public string Text { get; }
 043        internal IReadOnlyDictionary<string, object> AdditionalProperties { get; }
 44        /// <inheritdoc />
 045        public IEnumerator<KeyValuePair<string, object>> GetEnumerator() => AdditionalProperties.GetEnumerator();
 46        /// <inheritdoc />
 047        IEnumerator IEnumerable.GetEnumerator() => AdditionalProperties.GetEnumerator();
 48        /// <inheritdoc />
 049        public bool TryGetValue(string key, out object value) => AdditionalProperties.TryGetValue(key, out value);
 50        /// <inheritdoc />
 051        public bool ContainsKey(string key) => AdditionalProperties.ContainsKey(key);
 52        /// <inheritdoc />
 053        public IEnumerable<string> Keys => AdditionalProperties.Keys;
 54        /// <inheritdoc />
 055        public IEnumerable<object> Values => AdditionalProperties.Values;
 56        /// <inheritdoc />
 057        int IReadOnlyCollection<KeyValuePair<string, object>>.Count => AdditionalProperties.Count;
 58        /// <inheritdoc />
 59        public object this[string key]
 60        {
 061            get => AdditionalProperties[key];
 62        }
 63    }
 64}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SuggestResult.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    internal partial class SuggestResult
 15    {
 16        internal static SuggestResult DeserializeSuggestResult(JsonElement element)
 17        {
 018            string searchText = default;
 019            IReadOnlyDictionary<string, object> additionalProperties = default;
 020            Dictionary<string, object> additionalPropertiesDictionary = default;
 021            foreach (var property in element.EnumerateObject())
 22            {
 023                if (property.NameEquals("@search.text"))
 24                {
 025                    searchText = property.Value.GetString();
 026                    continue;
 27                }
 028                additionalPropertiesDictionary ??= new Dictionary<string, object>();
 029                additionalPropertiesDictionary.Add(property.Name, property.Value.GetObject());
 30            }
 031            additionalProperties = additionalPropertiesDictionary;
 032            return new SuggestResult(searchText, additionalProperties);
 33        }
 34    }
 35}