< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-0%0%
.ctor(...)-0%0%
get_PreserveOriginal()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%0%
DeserializePatternCaptureTokenFilter(...)-0%0%
get_Patterns()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PatternCaptureTokenFilter.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;
 9using System.Collections.Generic;
 10using System.Linq;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    /// <summary> Uses Java regexes to emit multiple tokens - one for each capture group in one or more patterns. This t
 15    public partial class PatternCaptureTokenFilter : TokenFilter
 16    {
 17        /// <summary> Initializes a new instance of PatternCaptureTokenFilter. </summary>
 18        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 19        /// <param name="patterns"> A list of patterns to match against each token. </param>
 20        /// <exception cref="ArgumentNullException"> <paramref name="name"/> or <paramref name="patterns"/> is null. </e
 021        public PatternCaptureTokenFilter(string name, IEnumerable<string> patterns) : base(name)
 22        {
 023            if (name == null)
 24            {
 025                throw new ArgumentNullException(nameof(name));
 26            }
 027            if (patterns == null)
 28            {
 029                throw new ArgumentNullException(nameof(patterns));
 30            }
 31
 032            Patterns = patterns.ToList();
 033            ODataType = "#Microsoft.Azure.Search.PatternCaptureTokenFilter";
 034        }
 35
 36        /// <summary> Initializes a new instance of PatternCaptureTokenFilter. </summary>
 37        /// <param name="oDataType"> Identifies the concrete type of the token filter. </param>
 38        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 39        /// <param name="patterns"> A list of patterns to match against each token. </param>
 40        /// <param name="preserveOriginal"> A value indicating whether to return the original token even if one of the p
 041        internal PatternCaptureTokenFilter(string oDataType, string name, IList<string> patterns, bool? preserveOriginal
 42        {
 043            Patterns = patterns;
 044            PreserveOriginal = preserveOriginal;
 045            ODataType = oDataType ?? "#Microsoft.Azure.Search.PatternCaptureTokenFilter";
 046        }
 47        /// <summary> A value indicating whether to return the original token even if one of the patterns matches. Defau
 048        public bool? PreserveOriginal { get; set; }
 49    }
 50}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PatternCaptureTokenFilter.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.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.Search.Documents.Indexes.Models
 13{
 14    public partial class PatternCaptureTokenFilter : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 018            writer.WriteStartObject();
 019            writer.WritePropertyName("patterns");
 020            writer.WriteStartArray();
 021            foreach (var item in Patterns)
 22            {
 023                writer.WriteStringValue(item);
 24            }
 025            writer.WriteEndArray();
 026            if (Optional.IsDefined(PreserveOriginal))
 27            {
 028                writer.WritePropertyName("preserveOriginal");
 029                writer.WriteBooleanValue(PreserveOriginal.Value);
 30            }
 031            writer.WritePropertyName("@odata.type");
 032            writer.WriteStringValue(ODataType);
 033            writer.WritePropertyName("name");
 034            writer.WriteStringValue(Name);
 035            writer.WriteEndObject();
 036        }
 37
 38        internal static PatternCaptureTokenFilter DeserializePatternCaptureTokenFilter(JsonElement element)
 39        {
 040            IList<string> patterns = default;
 041            Optional<bool> preserveOriginal = default;
 042            string odataType = default;
 043            string name = default;
 044            foreach (var property in element.EnumerateObject())
 45            {
 046                if (property.NameEquals("patterns"))
 47                {
 048                    List<string> array = new List<string>();
 049                    foreach (var item in property.Value.EnumerateArray())
 50                    {
 051                        array.Add(item.GetString());
 52                    }
 053                    patterns = array;
 054                    continue;
 55                }
 056                if (property.NameEquals("preserveOriginal"))
 57                {
 058                    preserveOriginal = property.Value.GetBoolean();
 059                    continue;
 60                }
 061                if (property.NameEquals("@odata.type"))
 62                {
 063                    odataType = property.Value.GetString();
 064                    continue;
 65                }
 066                if (property.NameEquals("name"))
 67                {
 068                    name = property.Value.GetString();
 69                    continue;
 70                }
 71            }
 072            return new PatternCaptureTokenFilter(odataType, name, patterns, Optional.ToNullable(preserveOriginal));
 73        }
 74    }
 75}

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Collections.Generic;
 5using Azure.Core;
 6
 7namespace Azure.Search.Documents.Indexes.Models
 8{
 9    public partial class PatternCaptureTokenFilter
 10    {
 11        /// <summary> A list of patterns to match against each token. </summary>
 012        public IList<string> Patterns { get; }
 13    }
 14}