< Summary

Class:Azure.Search.Documents.Indexes.Models.SentimentSkill
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SentimentSkill.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SentimentSkill.Serialization.cs
Covered lines:68
Uncovered lines:6
Coverable lines:74
Total lines:169
Line coverage:91.8% (68 of 74)
Covered branches:33
Total branches:38
Branch coverage:86.8% (33 of 38)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-71.43%50%
.ctor(...)-100%50%
get_DefaultLanguageCode()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-85.19%83.33%
DeserializeSentimentSkill(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SentimentSkill.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> Text analytics positive-negative sentiment analysis, scored as a floating point value in a range of ze
 14    public partial class SentimentSkill : SearchIndexerSkill
 15    {
 16        /// <summary> Initializes a new instance of SentimentSkill. </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 SentimentSkill(IEnumerable<InputFieldMappingEntry> inputs, IEnumerable<OutputFieldMappingEntry> outputs) 
 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.SentimentSkill";
 232        }
 33
 34        /// <summary> Initializes a new instance of SentimentSkill. </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
 41        /// <param name="defaultLanguageCode"> A value indicating which language code to use. Default is en. </param>
 642        internal SentimentSkill(string oDataType, string name, string description, string context, IList<InputFieldMappi
 43        {
 644            DefaultLanguageCode = defaultLanguageCode;
 645            ODataType = oDataType ?? "#Microsoft.Skills.Text.SentimentSkill";
 646        }
 47
 48        /// <summary> A value indicating which language code to use. Default is en. </summary>
 1649        public SentimentSkillLanguage? DefaultLanguageCode { get; set; }
 50    }
 51}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SentimentSkill.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 SentimentSkill : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 418            writer.WriteStartObject();
 419            if (Optional.IsDefined(DefaultLanguageCode))
 20            {
 421                writer.WritePropertyName("defaultLanguageCode");
 422                writer.WriteStringValue(DefaultLanguageCode.Value.ToString());
 23            }
 424            writer.WritePropertyName("@odata.type");
 425            writer.WriteStringValue(ODataType);
 426            if (Optional.IsDefined(Name))
 27            {
 028                writer.WritePropertyName("name");
 029                writer.WriteStringValue(Name);
 30            }
 431            if (Optional.IsDefined(Description))
 32            {
 033                writer.WritePropertyName("description");
 034                writer.WriteStringValue(Description);
 35            }
 436            if (Optional.IsDefined(Context))
 37            {
 438                writer.WritePropertyName("context");
 439                writer.WriteStringValue(Context);
 40            }
 441            writer.WritePropertyName("inputs");
 442            writer.WriteStartArray();
 2443            foreach (var item in Inputs)
 44            {
 845                writer.WriteObjectValue(item);
 46            }
 447            writer.WriteEndArray();
 448            writer.WritePropertyName("outputs");
 449            writer.WriteStartArray();
 1650            foreach (var item in Outputs)
 51            {
 452                writer.WriteObjectValue(item);
 53            }
 454            writer.WriteEndArray();
 455            writer.WriteEndObject();
 456        }
 57
 58        internal static SentimentSkill DeserializeSentimentSkill(JsonElement element)
 59        {
 660            Optional<SentimentSkillLanguage> defaultLanguageCode = default;
 661            string odataType = default;
 662            Optional<string> name = default;
 663            Optional<string> description = default;
 664            Optional<string> context = default;
 665            IList<InputFieldMappingEntry> inputs = default;
 666            IList<OutputFieldMappingEntry> outputs = default;
 9667            foreach (var property in element.EnumerateObject())
 68            {
 4269                if (property.NameEquals("defaultLanguageCode"))
 70                {
 671                    defaultLanguageCode = new SentimentSkillLanguage(property.Value.GetString());
 672                    continue;
 73                }
 3674                if (property.NameEquals("@odata.type"))
 75                {
 676                    odataType = property.Value.GetString();
 677                    continue;
 78                }
 3079                if (property.NameEquals("name"))
 80                {
 681                    name = property.Value.GetString();
 682                    continue;
 83                }
 2484                if (property.NameEquals("description"))
 85                {
 686                    description = property.Value.GetString();
 687                    continue;
 88                }
 1889                if (property.NameEquals("context"))
 90                {
 691                    context = property.Value.GetString();
 692                    continue;
 93                }
 1294                if (property.NameEquals("inputs"))
 95                {
 696                    List<InputFieldMappingEntry> array = new List<InputFieldMappingEntry>();
 3697                    foreach (var item in property.Value.EnumerateArray())
 98                    {
 1299                        array.Add(InputFieldMappingEntry.DeserializeInputFieldMappingEntry(item));
 100                    }
 6101                    inputs = array;
 6102                    continue;
 103                }
 6104                if (property.NameEquals("outputs"))
 105                {
 6106                    List<OutputFieldMappingEntry> array = new List<OutputFieldMappingEntry>();
 24107                    foreach (var item in property.Value.EnumerateArray())
 108                    {
 6109                        array.Add(OutputFieldMappingEntry.DeserializeOutputFieldMappingEntry(item));
 110                    }
 6111                    outputs = array;
 112                    continue;
 113                }
 114            }
 6115            return new SentimentSkill(odataType, name.Value, description.Value, context.Value, inputs, outputs, Optional
 116        }
 117    }
 118}