< Summary

Class:Azure.Search.Documents.Indexes.Models.LexicalAnalyzer
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\LexicalAnalyzer.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\LexicalAnalyzer.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\LexicalAnalyzer.cs
Covered lines:12
Uncovered lines:19
Coverable lines:31
Total lines:103
Line coverage:38.7% (12 of 31)
Covered branches:4
Total branches:18
Branch coverage:22.2% (4 of 18)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
get_ODataType()-100%100%
get_Name()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%100%
DeserializeLexicalAnalyzer(...)-20%18.75%
.ctor(...)-100%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\LexicalAnalyzer.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> Base type for analyzers. </summary>
 13    public partial class LexicalAnalyzer
 14    {
 15
 16        /// <summary> Initializes a new instance of LexicalAnalyzer. </summary>
 17        /// <param name="oDataType"> Identifies the concrete type of the analyzer. </param>
 18        /// <param name="name"> The name of the analyzer. It must only contain letters, digits, spaces, dashes or unders
 519        internal LexicalAnalyzer(string oDataType, string name)
 20        {
 521            ODataType = oDataType;
 522            Name = name;
 523        }
 24
 25        /// <summary> Identifies the concrete type of the analyzer. </summary>
 2026        internal string ODataType { get; set; }
 27        /// <summary> The name of the analyzer. It must only contain letters, digits, spaces, dashes or underscores, can
 1928        public string Name { get; set; }
 29    }
 30}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\LexicalAnalyzer.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 LexicalAnalyzer : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            writer.WritePropertyName("@odata.type");
 019            writer.WriteStringValue(ODataType);
 020            writer.WritePropertyName("name");
 021            writer.WriteStringValue(Name);
 022            writer.WriteEndObject();
 023        }
 24
 25        internal static LexicalAnalyzer DeserializeLexicalAnalyzer(JsonElement element)
 26        {
 527            if (element.TryGetProperty("@odata.type", out JsonElement discriminator))
 28            {
 529                switch (discriminator.GetString())
 30                {
 031                    case "#Microsoft.Azure.Search.CustomAnalyzer": return CustomAnalyzer.DeserializeCustomAnalyzer(eleme
 532                    case "#Microsoft.Azure.Search.PatternAnalyzer": return PatternAnalyzer.DeserializePatternAnalyzer(el
 033                    case "#Microsoft.Azure.Search.StandardAnalyzer": return LuceneStandardAnalyzer.DeserializeLuceneStan
 034                    case "#Microsoft.Azure.Search.StopAnalyzer": return StopAnalyzer.DeserializeStopAnalyzer(element);
 35                }
 36            }
 037            string odataType = default;
 038            string name = default;
 039            foreach (var property in element.EnumerateObject())
 40            {
 041                if (property.NameEquals("@odata.type"))
 42                {
 043                    odataType = property.Value.GetString();
 044                    continue;
 45                }
 046                if (property.NameEquals("name"))
 47                {
 048                    name = property.Value.GetString();
 49                    continue;
 50                }
 51            }
 052            return new LexicalAnalyzer(odataType, name);
 53        }
 54    }
 55}

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5
 6namespace Azure.Search.Documents.Indexes.Models
 7{
 8    public partial class LexicalAnalyzer
 9    {
 10        /// <summary> Initializes a new instance of LexicalAnalyzer. </summary>
 11        /// <param name="name"> The name of the analyzer. It must only contain letters, digits, spaces, dashes or unders
 12        /// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
 513        private protected LexicalAnalyzer(string name)
 14        {
 515            Name = name ?? throw new ArgumentNullException(nameof(name));
 516        }
 17    }
 18}