< Summary

Class:Azure.Search.Documents.Indexes.Models.OutputFieldMappingEntry
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\OutputFieldMappingEntry.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\OutputFieldMappingEntry.Serialization.cs
Covered lines:27
Uncovered lines:1
Coverable lines:28
Total lines:90
Line coverage:96.4% (27 of 28)
Covered branches:9
Total branches:10
Branch coverage:90% (9 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-80%50%
.ctor(...)-100%100%
get_Name()-100%100%
get_TargetName()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeOutputFieldMappingEntry(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\OutputFieldMappingEntry.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;
 9
 10namespace Azure.Search.Documents.Indexes.Models
 11{
 12    /// <summary> Output field mapping for a skill. </summary>
 13    public partial class OutputFieldMappingEntry
 14    {
 15        /// <summary> Initializes a new instance of OutputFieldMappingEntry. </summary>
 16        /// <param name="name"> The name of the output defined by the skill. </param>
 17        /// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
 1218        public OutputFieldMappingEntry(string name)
 19        {
 1220            if (name == null)
 21            {
 022                throw new ArgumentNullException(nameof(name));
 23            }
 24
 1225            Name = name;
 1226        }
 27
 28        /// <summary> Initializes a new instance of OutputFieldMappingEntry. </summary>
 29        /// <param name="name"> The name of the output defined by the skill. </param>
 30        /// <param name="targetName"> The target name of the output. It is optional and default to name. </param>
 3231        internal OutputFieldMappingEntry(string name, string targetName)
 32        {
 3233            Name = name;
 3234            TargetName = targetName;
 3235        }
 36
 37        /// <summary> The name of the output defined by the skill. </summary>
 12638        public string Name { get; set; }
 39        /// <summary> The target name of the output. It is optional and default to name. </summary>
 14840        public string TargetName { get; set; }
 41    }
 42}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\OutputFieldMappingEntry.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 OutputFieldMappingEntry : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 2217            writer.WriteStartObject();
 2218            writer.WritePropertyName("name");
 2219            writer.WriteStringValue(Name);
 2220            if (Optional.IsDefined(TargetName))
 21            {
 2222                writer.WritePropertyName("targetName");
 2223                writer.WriteStringValue(TargetName);
 24            }
 2225            writer.WriteEndObject();
 2226        }
 27
 28        internal static OutputFieldMappingEntry DeserializeOutputFieldMappingEntry(JsonElement element)
 29        {
 3230            string name = default;
 3231            Optional<string> targetName = default;
 19232            foreach (var property in element.EnumerateObject())
 33            {
 6434                if (property.NameEquals("name"))
 35                {
 3236                    name = property.Value.GetString();
 3237                    continue;
 38                }
 3239                if (property.NameEquals("targetName"))
 40                {
 3241                    targetName = property.Value.GetString();
 42                    continue;
 43                }
 44            }
 3245            return new OutputFieldMappingEntry(name, targetName.Value);
 46        }
 47    }
 48}