< Summary

Class:Azure.Search.Documents.Indexes.Models.TokenFilter
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\TokenFilter.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\TokenFilter.Serialization.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\TokenFilter.cs
Covered lines:11
Uncovered lines:41
Coverable lines:52
Total lines:124
Line coverage:21.1% (11 of 52)
Covered branches:22
Total branches:126
Branch coverage:17.4% (22 of 126)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%100%
get_ODataType()-100%100%
get_Name()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%100%
DeserializeTokenFilter(...)-16.67%16.94%
.ctor(...)-100%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\TokenFilter.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 token filters. </summary>
 13    public partial class TokenFilter
 14    {
 15
 16        /// <summary> Initializes a new instance of TokenFilter. </summary>
 17        /// <param name="oDataType"> Identifies the concrete type of the token filter. </param>
 18        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 019        internal TokenFilter(string oDataType, string name)
 20        {
 021            ODataType = oDataType;
 022            Name = name;
 023        }
 24
 25        /// <summary> Identifies the concrete type of the token filter. </summary>
 2026        internal string ODataType { get; set; }
 27        /// <summary> The name of the token filter. It must only contain letters, digits, spaces, dashes or underscores,
 1428        public string Name { get; set; }
 29    }
 30}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\TokenFilter.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 TokenFilter : 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 TokenFilter DeserializeTokenFilter(JsonElement element)
 26        {
 427            if (element.TryGetProperty("@odata.type", out JsonElement discriminator))
 28            {
 429                switch (discriminator.GetString())
 30                {
 031                    case "#Microsoft.Azure.Search.AsciiFoldingTokenFilter": return AsciiFoldingTokenFilter.DeserializeAs
 032                    case "#Microsoft.Azure.Search.CjkBigramTokenFilter": return CjkBigramTokenFilter.DeserializeCjkBigra
 033                    case "#Microsoft.Azure.Search.CommonGramTokenFilter": return CommonGramTokenFilter.DeserializeCommon
 034                    case "#Microsoft.Azure.Search.DictionaryDecompounderTokenFilter": return DictionaryDecompounderToken
 135                    case "#Microsoft.Azure.Search.EdgeNGramTokenFilter": return EdgeNGramTokenFilter.DeserializeEdgeNGra
 136                    case "#Microsoft.Azure.Search.EdgeNGramTokenFilterV2": return EdgeNGramTokenFilter.DeserializeEdgeNG
 037                    case "#Microsoft.Azure.Search.ElisionTokenFilter": return ElisionTokenFilter.DeserializeElisionToken
 038                    case "#Microsoft.Azure.Search.KeepTokenFilter": return KeepTokenFilter.DeserializeKeepTokenFilter(el
 039                    case "#Microsoft.Azure.Search.KeywordMarkerTokenFilter": return KeywordMarkerTokenFilter.Deserialize
 040                    case "#Microsoft.Azure.Search.LengthTokenFilter": return LengthTokenFilter.DeserializeLengthTokenFil
 041                    case "#Microsoft.Azure.Search.LimitTokenFilter": return LimitTokenFilter.DeserializeLimitTokenFilter
 142                    case "#Microsoft.Azure.Search.NGramTokenFilter": return NGramTokenFilter.DeserializeNGramTokenFilter
 143                    case "#Microsoft.Azure.Search.NGramTokenFilterV2": return NGramTokenFilter.DeserializeNGramTokenFilt
 044                    case "#Microsoft.Azure.Search.PatternCaptureTokenFilter": return PatternCaptureTokenFilter.Deseriali
 045                    case "#Microsoft.Azure.Search.PatternReplaceTokenFilter": return PatternReplaceTokenFilter.Deseriali
 046                    case "#Microsoft.Azure.Search.PhoneticTokenFilter": return PhoneticTokenFilter.DeserializePhoneticTo
 047                    case "#Microsoft.Azure.Search.ShingleTokenFilter": return ShingleTokenFilter.DeserializeShingleToken
 048                    case "#Microsoft.Azure.Search.SnowballTokenFilter": return SnowballTokenFilter.DeserializeSnowballTo
 049                    case "#Microsoft.Azure.Search.StemmerOverrideTokenFilter": return StemmerOverrideTokenFilter.Deseria
 050                    case "#Microsoft.Azure.Search.StemmerTokenFilter": return StemmerTokenFilter.DeserializeStemmerToken
 051                    case "#Microsoft.Azure.Search.StopwordsTokenFilter": return StopwordsTokenFilter.DeserializeStopword
 052                    case "#Microsoft.Azure.Search.SynonymTokenFilter": return SynonymTokenFilter.DeserializeSynonymToken
 053                    case "#Microsoft.Azure.Search.TruncateTokenFilter": return TruncateTokenFilter.DeserializeTruncateTo
 054                    case "#Microsoft.Azure.Search.UniqueTokenFilter": return UniqueTokenFilter.DeserializeUniqueTokenFil
 055                    case "#Microsoft.Azure.Search.WordDelimiterTokenFilter": return WordDelimiterTokenFilter.Deserialize
 56                }
 57            }
 058            string odataType = default;
 059            string name = default;
 060            foreach (var property in element.EnumerateObject())
 61            {
 062                if (property.NameEquals("@odata.type"))
 63                {
 064                    odataType = property.Value.GetString();
 065                    continue;
 66                }
 067                if (property.NameEquals("name"))
 68                {
 069                    name = property.Value.GetString();
 70                    continue;
 71                }
 72            }
 073            return new TokenFilter(odataType, name);
 74        }
 75    }
 76}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Indexes\Models\TokenFilter.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 TokenFilter
 9    {
 10        /// <summary> Initializes a new instance of TokenFilter. </summary>
 11        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 12        /// <exception cref="ArgumentNullException"><paramref name="name"/> is null.</exception>
 613        private protected TokenFilter(string name)
 14        {
 615            Name = name ?? throw new ArgumentNullException(nameof(name));
 616        }
 17    }
 18}