< Summary

Class:Azure.Search.Documents.Indexes.Models.SimilarityAlgorithm
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SimilarityAlgorithm.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SimilarityAlgorithm.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\SimilarityAlgorithm.cs
Covered lines:7
Uncovered lines:13
Coverable lines:20
Total lines:84
Line coverage:35% (7 of 20)
Covered branches:2
Total branches:10
Branch coverage:20% (2 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
get_ODataType()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%100%
DeserializeSimilarityAlgorithm(...)-33.33%20%
.ctor()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SimilarityAlgorithm.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
 8namespace Azure.Search.Documents.Indexes.Models
 9{
 10    /// <summary> Base type for similarity algorithms. Similarity algorithms are used to calculate scores that tie queri
 11    public partial class SimilarityAlgorithm
 12    {
 13
 14        /// <summary> Initializes a new instance of SimilarityAlgorithm. </summary>
 15        /// <param name="oDataType"> . </param>
 1616        internal SimilarityAlgorithm(string oDataType)
 17        {
 1618            ODataType = oDataType;
 1619        }
 20
 3421        internal string ODataType { get; set; }
 22    }
 23}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\SimilarityAlgorithm.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 SimilarityAlgorithm : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            writer.WritePropertyName("@odata.type");
 019            writer.WriteStringValue(ODataType);
 020            writer.WriteEndObject();
 021        }
 22
 23        internal static SimilarityAlgorithm DeserializeSimilarityAlgorithm(JsonElement element)
 24        {
 1625            if (element.TryGetProperty("@odata.type", out JsonElement discriminator))
 26            {
 1627                switch (discriminator.GetString())
 28                {
 1629                    case "#Microsoft.Azure.Search.BM25Similarity": return BM25Similarity.DeserializeBM25Similarity(eleme
 030                    case "#Microsoft.Azure.Search.ClassicSimilarity": return ClassicSimilarity.DeserializeClassicSimilar
 31                }
 32            }
 033            string odataType = default;
 034            foreach (var property in element.EnumerateObject())
 35            {
 036                if (property.NameEquals("@odata.type"))
 37                {
 038                    odataType = property.Value.GetString();
 39                    continue;
 40                }
 41            }
 042            return new SimilarityAlgorithm(odataType);
 43        }
 44    }
 45}

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using Azure.Core;
 5
 6namespace Azure.Search.Documents.Indexes.Models
 7{
 8    [CodeGenModel("Similarity")]
 9    public partial class SimilarityAlgorithm
 10    {
 11        /// <summary> Initializes a new instance of SimilarityAlgorithm. </summary>
 012        private protected SimilarityAlgorithm()
 13        {
 014        }
 15    }
 16}