< Summary

Class:Azure.Search.Documents.Indexes.Models.DistanceScoringParameters
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\DistanceScoringParameters.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\DistanceScoringParameters.Serialization.cs
Covered lines:23
Uncovered lines:1
Coverable lines:24
Total lines:80
Line coverage:95.8% (23 of 24)
Covered branches:7
Total branches:8
Branch coverage:87.5% (7 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-83.33%50%
get_ReferencePointParameter()-100%100%
get_BoostingDistance()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-100%100%
DeserializeDistanceScoringParameters(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\DistanceScoringParameters.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> Provides parameter values to a distance scoring function. </summary>
 13    public partial class DistanceScoringParameters
 14    {
 15        /// <summary> Initializes a new instance of DistanceScoringParameters. </summary>
 16        /// <param name="referencePointParameter"> The name of the parameter passed in search queries to specify the ref
 17        /// <param name="boostingDistance"> The distance in kilometers from the reference location where the boosting ra
 18        /// <exception cref="ArgumentNullException"> <paramref name="referencePointParameter"/> is null. </exception>
 1419        public DistanceScoringParameters(string referencePointParameter, double boostingDistance)
 20        {
 1421            if (referencePointParameter == null)
 22            {
 023                throw new ArgumentNullException(nameof(referencePointParameter));
 24            }
 25
 1426            ReferencePointParameter = referencePointParameter;
 1427            BoostingDistance = boostingDistance;
 1428        }
 29
 30        /// <summary> The name of the parameter passed in search queries to specify the reference location. </summary>
 2031        public string ReferencePointParameter { get; set; }
 32        /// <summary> The distance in kilometers from the reference location where the boosting range ends. </summary>
 2033        public double BoostingDistance { get; set; }
 34    }
 35}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\DistanceScoringParameters.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 DistanceScoringParameters : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 617            writer.WriteStartObject();
 618            writer.WritePropertyName("referencePointParameter");
 619            writer.WriteStringValue(ReferencePointParameter);
 620            writer.WritePropertyName("boostingDistance");
 621            writer.WriteNumberValue(BoostingDistance);
 622            writer.WriteEndObject();
 623        }
 24
 25        internal static DistanceScoringParameters DeserializeDistanceScoringParameters(JsonElement element)
 26        {
 1027            string referencePointParameter = default;
 1028            double boostingDistance = default;
 6029            foreach (var property in element.EnumerateObject())
 30            {
 2031                if (property.NameEquals("referencePointParameter"))
 32                {
 1033                    referencePointParameter = property.Value.GetString();
 1034                    continue;
 35                }
 1036                if (property.NameEquals("boostingDistance"))
 37                {
 1038                    boostingDistance = property.Value.GetDouble();
 39                    continue;
 40                }
 41            }
 1042            return new DistanceScoringParameters(referencePointParameter, boostingDistance);
 43        }
 44    }
 45}