< Summary

Class:Azure.Search.Documents.Indexes.Models.PatternReplaceTokenFilter
Assembly:Azure.Search.Documents
File(s):C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PatternReplaceTokenFilter.cs
C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PatternReplaceTokenFilter.Serialization.cs
Covered lines:0
Uncovered lines:46
Coverable lines:46
Total lines:118
Line coverage:0% (0 of 46)
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_Pattern()-0%100%
get_Replacement()-0%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%100%
DeserializePatternReplaceTokenFilter(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PatternReplaceTokenFilter.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> A character filter that replaces characters in the input string. It uses a regular expression to ident
 13    public partial class PatternReplaceTokenFilter : TokenFilter
 14    {
 15        /// <summary> Initializes a new instance of PatternReplaceTokenFilter. </summary>
 16        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 17        /// <param name="pattern"> A regular expression pattern. </param>
 18        /// <param name="replacement"> The replacement text. </param>
 19        /// <exception cref="ArgumentNullException"> <paramref name="name"/>, <paramref name="pattern"/>, or <paramref n
 020        public PatternReplaceTokenFilter(string name, string pattern, string replacement) : base(name)
 21        {
 022            if (name == null)
 23            {
 024                throw new ArgumentNullException(nameof(name));
 25            }
 026            if (pattern == null)
 27            {
 028                throw new ArgumentNullException(nameof(pattern));
 29            }
 030            if (replacement == null)
 31            {
 032                throw new ArgumentNullException(nameof(replacement));
 33            }
 34
 035            Pattern = pattern;
 036            Replacement = replacement;
 037            ODataType = "#Microsoft.Azure.Search.PatternReplaceTokenFilter";
 038        }
 39
 40        /// <summary> Initializes a new instance of PatternReplaceTokenFilter. </summary>
 41        /// <param name="oDataType"> Identifies the concrete type of the token filter. </param>
 42        /// <param name="name"> The name of the token filter. It must only contain letters, digits, spaces, dashes or un
 43        /// <param name="pattern"> A regular expression pattern. </param>
 44        /// <param name="replacement"> The replacement text. </param>
 045        internal PatternReplaceTokenFilter(string oDataType, string name, string pattern, string replacement) : base(oDa
 46        {
 047            Pattern = pattern;
 048            Replacement = replacement;
 049            ODataType = oDataType ?? "#Microsoft.Azure.Search.PatternReplaceTokenFilter";
 050        }
 51
 52        /// <summary> A regular expression pattern. </summary>
 053        public string Pattern { get; set; }
 54        /// <summary> The replacement text. </summary>
 055        public string Replacement { get; set; }
 56    }
 57}

C:\Git\azure-sdk-for-net\sdk\search\Azure.Search.Documents\src\Generated\Models\PatternReplaceTokenFilter.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 PatternReplaceTokenFilter : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            writer.WritePropertyName("pattern");
 019            writer.WriteStringValue(Pattern);
 020            writer.WritePropertyName("replacement");
 021            writer.WriteStringValue(Replacement);
 022            writer.WritePropertyName("@odata.type");
 023            writer.WriteStringValue(ODataType);
 024            writer.WritePropertyName("name");
 025            writer.WriteStringValue(Name);
 026            writer.WriteEndObject();
 027        }
 28
 29        internal static PatternReplaceTokenFilter DeserializePatternReplaceTokenFilter(JsonElement element)
 30        {
 031            string pattern = default;
 032            string replacement = default;
 033            string odataType = default;
 034            string name = default;
 035            foreach (var property in element.EnumerateObject())
 36            {
 037                if (property.NameEquals("pattern"))
 38                {
 039                    pattern = property.Value.GetString();
 040                    continue;
 41                }
 042                if (property.NameEquals("replacement"))
 43                {
 044                    replacement = property.Value.GetString();
 045                    continue;
 46                }
 047                if (property.NameEquals("@odata.type"))
 48                {
 049                    odataType = property.Value.GetString();
 050                    continue;
 51                }
 052                if (property.NameEquals("name"))
 53                {
 054                    name = property.Value.GetString();
 55                    continue;
 56                }
 57            }
 058            return new PatternReplaceTokenFilter(odataType, name, pattern, replacement);
 59        }
 60    }
 61}