< Summary

Class:Azure.AI.FormRecognizer.Models.KeysResult
Assembly:Azure.AI.FormRecognizer
File(s):C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\KeysResult.cs
C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\KeysResult.Serialization.cs
Covered lines:16
Uncovered lines:1
Coverable lines:17
Total lines:72
Line coverage:94.1% (16 of 17)
Covered branches:9
Total branches:10
Branch coverage:90% (9 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
get_Clusters()-100%100%
DeserializeKeysResult(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\KeysResult.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;
 10
 11namespace Azure.AI.FormRecognizer.Models
 12{
 13    /// <summary> Keys extracted by the custom model. </summary>
 14    internal partial class KeysResult
 15    {
 16        /// <summary> Initializes a new instance of KeysResult. </summary>
 17        /// <param name="clusters"> Object mapping clusterIds to a list of keys. </param>
 18        /// <exception cref="ArgumentNullException"> <paramref name="clusters"/> is null. </exception>
 8019        internal KeysResult(IReadOnlyDictionary<string, IList<string>> clusters)
 20        {
 8021            if (clusters == null)
 22            {
 023                throw new ArgumentNullException(nameof(clusters));
 24            }
 25
 8026            Clusters = clusters;
 8027        }
 28
 29        /// <summary> Object mapping clusterIds to a list of keys. </summary>
 7230        public IReadOnlyDictionary<string, IList<string>> Clusters { get; }
 31    }
 32}

C:\Git\azure-sdk-for-net\sdk\formrecognizer\Azure.AI.FormRecognizer\src\Generated\Models\KeysResult.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.AI.FormRecognizer.Models
 13{
 14    internal partial class KeysResult
 15    {
 16        internal static KeysResult DeserializeKeysResult(JsonElement element)
 17        {
 8018            IReadOnlyDictionary<string, IList<string>> clusters = default;
 32019            foreach (var property in element.EnumerateObject())
 20            {
 8021                if (property.NameEquals("clusters"))
 22                {
 8023                    Dictionary<string, IList<string>> dictionary = new Dictionary<string, IList<string>>();
 32024                    foreach (var property0 in property.Value.EnumerateObject())
 25                    {
 8026                        List<string> array = new List<string>();
 328027                        foreach (var item in property0.Value.EnumerateArray())
 28                        {
 156029                            array.Add(item.GetString());
 30                        }
 8031                        dictionary.Add(property0.Name, array);
 32                    }
 8033                    clusters = dictionary;
 34                    continue;
 35                }
 36            }
 8037            return new KeysResult(clusters);
 38        }
 39    }
 40}