< Summary

Class:Azure.Search.Documents.Indexes.Models.LanguageDetectionSkill
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\LanguageDetectionSkill.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\LanguageDetectionSkill.Serialization.cs
Covered lines:59
Uncovered lines:6
Coverable lines:65
Total lines:153
Line coverage:90.7% (59 of 65)
Covered branches:29
Total branches:34
Branch coverage:85.2% (29 of 34)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-71.43%50%
.ctor(...)-100%50%
Azure.Core.IUtf8JsonSerializable.Write(...)-83.33%80%
DeserializeLanguageDetectionSkill(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\LanguageDetectionSkill.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.Search.Documents.Indexes.Models
 12{
 13    /// <summary> A skill that detects the language of input text and reports a single language code for every document 
 14    public partial class LanguageDetectionSkill : SearchIndexerSkill
 15    {
 16        /// <summary> Initializes a new instance of LanguageDetectionSkill. </summary>
 17        /// <param name="inputs"> Inputs of the skills could be a column in the source data set, or the output of an ups
 18        /// <param name="outputs"> The output of a skill is either a field in a search index, or a value that can be con
 19        /// <exception cref="ArgumentNullException"> <paramref name="inputs"/> or <paramref name="outputs"/> is null. </
 220        public LanguageDetectionSkill(IEnumerable<InputFieldMappingEntry> inputs, IEnumerable<OutputFieldMappingEntry> o
 21        {
 222            if (inputs == null)
 23            {
 024                throw new ArgumentNullException(nameof(inputs));
 25            }
 226            if (outputs == null)
 27            {
 028                throw new ArgumentNullException(nameof(outputs));
 29            }
 30
 231            ODataType = "#Microsoft.Skills.Text.LanguageDetectionSkill";
 232        }
 33
 34        /// <summary> Initializes a new instance of LanguageDetectionSkill. </summary>
 35        /// <param name="oDataType"> Identifies the concrete type of the skill. </param>
 36        /// <param name="name"> The name of the skill which uniquely identifies it within the skillset. A skill with no 
 37        /// <param name="description"> The description of the skill which describes the inputs, outputs, and usage of th
 38        /// <param name="context"> Represents the level at which operations take place, such as the document root or doc
 39        /// <param name="inputs"> Inputs of the skills could be a column in the source data set, or the output of an ups
 40        /// <param name="outputs"> The output of a skill is either a field in a search index, or a value that can be con
 641        internal LanguageDetectionSkill(string oDataType, string name, string description, string context, IList<InputFi
 42        {
 643            ODataType = oDataType ?? "#Microsoft.Skills.Text.LanguageDetectionSkill";
 644        }
 45    }
 46}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\LanguageDetectionSkill.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.Indexes.Models
 13{
 14    public partial class LanguageDetectionSkill : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 418            writer.WriteStartObject();
 419            writer.WritePropertyName("@odata.type");
 420            writer.WriteStringValue(ODataType);
 421            if (Optional.IsDefined(Name))
 22            {
 023                writer.WritePropertyName("name");
 024                writer.WriteStringValue(Name);
 25            }
 426            if (Optional.IsDefined(Description))
 27            {
 028                writer.WritePropertyName("description");
 029                writer.WriteStringValue(Description);
 30            }
 431            if (Optional.IsDefined(Context))
 32            {
 433                writer.WritePropertyName("context");
 434                writer.WriteStringValue(Context);
 35            }
 436            writer.WritePropertyName("inputs");
 437            writer.WriteStartArray();
 1638            foreach (var item in Inputs)
 39            {
 440                writer.WriteObjectValue(item);
 41            }
 442            writer.WriteEndArray();
 443            writer.WritePropertyName("outputs");
 444            writer.WriteStartArray();
 1645            foreach (var item in Outputs)
 46            {
 447                writer.WriteObjectValue(item);
 48            }
 449            writer.WriteEndArray();
 450            writer.WriteEndObject();
 451        }
 52
 53        internal static LanguageDetectionSkill DeserializeLanguageDetectionSkill(JsonElement element)
 54        {
 655            string odataType = default;
 656            Optional<string> name = default;
 657            Optional<string> description = default;
 658            Optional<string> context = default;
 659            IList<InputFieldMappingEntry> inputs = default;
 660            IList<OutputFieldMappingEntry> outputs = default;
 8461            foreach (var property in element.EnumerateObject())
 62            {
 3663                if (property.NameEquals("@odata.type"))
 64                {
 665                    odataType = property.Value.GetString();
 666                    continue;
 67                }
 3068                if (property.NameEquals("name"))
 69                {
 670                    name = property.Value.GetString();
 671                    continue;
 72                }
 2473                if (property.NameEquals("description"))
 74                {
 675                    description = property.Value.GetString();
 676                    continue;
 77                }
 1878                if (property.NameEquals("context"))
 79                {
 680                    context = property.Value.GetString();
 681                    continue;
 82                }
 1283                if (property.NameEquals("inputs"))
 84                {
 685                    List<InputFieldMappingEntry> array = new List<InputFieldMappingEntry>();
 2486                    foreach (var item in property.Value.EnumerateArray())
 87                    {
 688                        array.Add(InputFieldMappingEntry.DeserializeInputFieldMappingEntry(item));
 89                    }
 690                    inputs = array;
 691                    continue;
 92                }
 693                if (property.NameEquals("outputs"))
 94                {
 695                    List<OutputFieldMappingEntry> array = new List<OutputFieldMappingEntry>();
 2496                    foreach (var item in property.Value.EnumerateArray())
 97                    {
 698                        array.Add(OutputFieldMappingEntry.DeserializeOutputFieldMappingEntry(item));
 99                    }
 6100                    outputs = array;
 101                    continue;
 102                }
 103            }
 6104            return new LanguageDetectionSkill(odataType, name.Value, description.Value, context.Value, inputs, outputs);
 105        }
 106    }
 107}