< Summary

Class:Azure.Search.Documents.Indexes.Models.CognitiveServicesAccount
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\CognitiveServicesAccount.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\CognitiveServicesAccount.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\CognitiveServicesAccount.cs
Covered lines:12
Uncovered lines:17
Coverable lines:29
Total lines:97
Line coverage:41.3% (12 of 29)
Covered branches:4
Total branches:14
Branch coverage:28.5% (4 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
get_ODataType()-100%100%
get_Description()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeCognitiveServicesAccount(...)-30.77%33.33%
.ctor()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\CognitiveServicesAccount.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
 8namespace Azure.Search.Documents.Indexes.Models
 9{
 10    /// <summary> Base type for describing any cognitive service resource attached to a skillset. </summary>
 11    public partial class CognitiveServicesAccount
 12    {
 13
 14        /// <summary> Initializes a new instance of CognitiveServicesAccount. </summary>
 15        /// <param name="oDataType"> Identifies the concrete type of the cognitive service resource attached to a skills
 16        /// <param name="description"> Description of the cognitive service resource attached to a skillset. </param>
 717        internal CognitiveServicesAccount(string oDataType, string description)
 18        {
 719            ODataType = oDataType;
 720            Description = description;
 721        }
 22
 23        /// <summary> Identifies the concrete type of the cognitive service resource attached to a skillset. </summary>
 2224        internal string ODataType { get; set; }
 25        /// <summary> Description of the cognitive service resource attached to a skillset. </summary>
 1226        public string Description { get; set; }
 27    }
 28}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\CognitiveServicesAccount.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.Search.Documents.Indexes.Models
 12{
 13    public partial class CognitiveServicesAccount : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            writer.WritePropertyName("@odata.type");
 019            writer.WriteStringValue(ODataType);
 020            if (Optional.IsDefined(Description))
 21            {
 022                writer.WritePropertyName("description");
 023                writer.WriteStringValue(Description);
 24            }
 025            writer.WriteEndObject();
 026        }
 27
 28        internal static CognitiveServicesAccount DeserializeCognitiveServicesAccount(JsonElement element)
 29        {
 730            if (element.TryGetProperty("@odata.type", out JsonElement discriminator))
 31            {
 732                switch (discriminator.GetString())
 33                {
 134                    case "#Microsoft.Azure.Search.CognitiveServicesByKey": return CognitiveServicesAccountKey.Deserializ
 635                    case "#Microsoft.Azure.Search.DefaultCognitiveServices": return DefaultCognitiveServicesAccount.Dese
 36                }
 37            }
 038            string odataType = default;
 039            Optional<string> description = default;
 040            foreach (var property in element.EnumerateObject())
 41            {
 042                if (property.NameEquals("@odata.type"))
 43                {
 044                    odataType = property.Value.GetString();
 045                    continue;
 46                }
 047                if (property.NameEquals("description"))
 48                {
 049                    description = property.Value.GetString();
 50                    continue;
 51                }
 52            }
 053            return new CognitiveServicesAccount(odataType, description.Value);
 54        }
 55    }
 56}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\CognitiveServicesAccount.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4namespace Azure.Search.Documents.Indexes.Models
 5{
 6    public partial class CognitiveServicesAccount
 7    {
 8        /// <summary> Initializes a new instance of CognitiveServicesAccount. </summary>
 39        private protected CognitiveServicesAccount()
 10        {
 311        }
 12    }
 13}