< Summary

Class:Azure.Search.Documents.Indexes.Models.FieldMappingFunction
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\FieldMappingFunction.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\FieldMappingFunction.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\FieldMappingFunction.cs
Covered lines:0
Uncovered lines:36
Coverable lines:36
Total lines:117
Line coverage:0% (0 of 36)
Covered branches:0
Total branches:14
Branch coverage:0% (0 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%100%
get_Name()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeFieldMappingFunction(...)-0%0%
get_Parameters()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\FieldMappingFunction.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;
 10using Azure.Core;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    /// <summary> Represents a function that transforms a value from a data source before indexing. </summary>
 15    public partial class FieldMappingFunction
 16    {
 17        /// <summary> Initializes a new instance of FieldMappingFunction. </summary>
 18        /// <param name="name"> The name of the field mapping function. </param>
 19        /// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
 020        public FieldMappingFunction(string name)
 21        {
 022            if (name == null)
 23            {
 024                throw new ArgumentNullException(nameof(name));
 25            }
 26
 027            Name = name;
 028            Parameters = new ChangeTrackingDictionary<string, object>();
 029        }
 30
 31        /// <summary> Initializes a new instance of FieldMappingFunction. </summary>
 32        /// <param name="name"> The name of the field mapping function. </param>
 33        /// <param name="parameters"> A dictionary of parameter name/value pairs to pass to the function. Each value mus
 034        internal FieldMappingFunction(string name, IDictionary<string, object> parameters)
 35        {
 036            Name = name;
 037            Parameters = parameters;
 038        }
 39
 40        /// <summary> The name of the field mapping function. </summary>
 041        public string Name { get; set; }
 42    }
 43}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\FieldMappingFunction.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 FieldMappingFunction : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("name");
 020            writer.WriteStringValue(Name);
 021            if (Optional.IsCollectionDefined(Parameters))
 22            {
 023                writer.WritePropertyName("parameters");
 024                writer.WriteStartObject();
 025                foreach (var item in Parameters)
 26                {
 027                    writer.WritePropertyName(item.Key);
 028                    writer.WriteObjectValue(item.Value);
 29                }
 030                writer.WriteEndObject();
 31            }
 032            writer.WriteEndObject();
 033        }
 34
 35        internal static FieldMappingFunction DeserializeFieldMappingFunction(JsonElement element)
 36        {
 037            string name = default;
 038            Optional<IDictionary<string, object>> parameters = default;
 039            foreach (var property in element.EnumerateObject())
 40            {
 041                if (property.NameEquals("name"))
 42                {
 043                    name = property.Value.GetString();
 044                    continue;
 45                }
 046                if (property.NameEquals("parameters"))
 47                {
 048                    Dictionary<string, object> dictionary = new Dictionary<string, object>();
 049                    foreach (var property0 in property.Value.EnumerateObject())
 50                    {
 051                        dictionary.Add(property0.Name, property0.Value.GetObject());
 52                    }
 053                    parameters = dictionary;
 54                    continue;
 55                }
 56            }
 057            return new FieldMappingFunction(name, Optional.ToDictionary(parameters));
 58        }
 59    }
 60}

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using Azure.Core;
 6
 7namespace Azure.Search.Documents.Indexes.Models
 8{
 9    public partial class FieldMappingFunction
 10    {
 11        /// <summary> A dictionary of parameter name/value pairs to pass to the function. Each value must be of a primit
 012        public IDictionary<string, object> Parameters { get; }
 13    }
 14}