< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_MaxTokenCount()-0%100%
get_ConsumeAllTokens()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializeLimitTokenFilter(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\LimitTokenFilter.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> Limits the number of tokens while indexing. This token filter is implemented using Apache Lucene. </su
 13    public partial class LimitTokenFilter : TokenFilter
 14    {
 15        /// <summary> Initializes a new instance of LimitTokenFilter. </summary>
 16        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 17        /// <exception cref="ArgumentNullException"> <paramref name="name"/> is null. </exception>
 018        public LimitTokenFilter(string name) : base(name)
 19        {
 020            if (name == null)
 21            {
 022                throw new ArgumentNullException(nameof(name));
 23            }
 24
 025            ODataType = "#Microsoft.Azure.Search.LimitTokenFilter";
 026        }
 27
 28        /// <summary> Initializes a new instance of LimitTokenFilter. </summary>
 29        /// <param name="oDataType"> Identifies the concrete type of the token filter. </param>
 30        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 31        /// <param name="maxTokenCount"> The maximum number of tokens to produce. Default is 1. </param>
 32        /// <param name="consumeAllTokens"> A value indicating whether all tokens from the input must be consumed even i
 033        internal LimitTokenFilter(string oDataType, string name, int? maxTokenCount, bool? consumeAllTokens) : base(oDat
 34        {
 035            MaxTokenCount = maxTokenCount;
 036            ConsumeAllTokens = consumeAllTokens;
 037            ODataType = oDataType ?? "#Microsoft.Azure.Search.LimitTokenFilter";
 038        }
 39
 40        /// <summary> The maximum number of tokens to produce. Default is 1. </summary>
 041        public int? MaxTokenCount { get; set; }
 42        /// <summary> A value indicating whether all tokens from the input must be consumed even if maxTokenCount is rea
 043        public bool? ConsumeAllTokens { get; set; }
 44    }
 45}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\LimitTokenFilter.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 LimitTokenFilter : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            if (Optional.IsDefined(MaxTokenCount))
 19            {
 020                writer.WritePropertyName("maxTokenCount");
 021                writer.WriteNumberValue(MaxTokenCount.Value);
 22            }
 023            if (Optional.IsDefined(ConsumeAllTokens))
 24            {
 025                writer.WritePropertyName("consumeAllTokens");
 026                writer.WriteBooleanValue(ConsumeAllTokens.Value);
 27            }
 028            writer.WritePropertyName("@odata.type");
 029            writer.WriteStringValue(ODataType);
 030            writer.WritePropertyName("name");
 031            writer.WriteStringValue(Name);
 032            writer.WriteEndObject();
 033        }
 34
 35        internal static LimitTokenFilter DeserializeLimitTokenFilter(JsonElement element)
 36        {
 037            Optional<int> maxTokenCount = default;
 038            Optional<bool> consumeAllTokens = default;
 039            string odataType = default;
 040            string name = default;
 041            foreach (var property in element.EnumerateObject())
 42            {
 043                if (property.NameEquals("maxTokenCount"))
 44                {
 045                    maxTokenCount = property.Value.GetInt32();
 046                    continue;
 47                }
 048                if (property.NameEquals("consumeAllTokens"))
 49                {
 050                    consumeAllTokens = property.Value.GetBoolean();
 051                    continue;
 52                }
 053                if (property.NameEquals("@odata.type"))
 54                {
 055                    odataType = property.Value.GetString();
 056                    continue;
 57                }
 058                if (property.NameEquals("name"))
 59                {
 060                    name = property.Value.GetString();
 61                    continue;
 62                }
 63            }
 064            return new LimitTokenFilter(odataType, name, Optional.ToNullable(maxTokenCount), Optional.ToNullable(consume
 65        }
 66    }
 67}