< Summary

Class:Microsoft.Azure.Search.Models.CharFilterName
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Indexes\Models\CharFilterName.cs
Covered lines:7
Uncovered lines:5
Coverable lines:12
Total lines:92
Line coverage:58.3% (7 of 12)
Covered branches:0
Total branches:2
Branch coverage:0% (0 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.cctor()-100%100%
.ctor(...)-100%100%
op_Implicit(...)-100%100%
op_Explicit(...)-0%100%
op_Equality(...)-0%100%
op_Inequality(...)-0%100%
Equals(...)-100%100%
Equals(...)-0%0%
GetHashCode()-0%100%
ToString()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Indexes\Models\CharFilterName.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for
 3// license information.
 4
 5namespace Microsoft.Azure.Search.Models
 6{
 7    using System;
 8    using Microsoft.Azure.Search.Common;
 9    using Newtonsoft.Json;
 10    using Serialization;
 11
 12    /// <summary>
 13    /// Defines the names of all character filters supported by Azure Cognitive Search.
 14    /// For more information, see <see href="https://docs.microsoft.com/azure/search/index-add-custom-analyzers">Add cus
 15    /// </summary>
 16    [JsonConverter(typeof(ExtensibleEnumConverter<CharFilterName>))]
 17    public struct CharFilterName : IEquatable<CharFilterName>
 18    {
 19        private readonly string _value;
 20
 21        // MAINTENANCE NOTE: Keep these ordered the same as the table on this page:
 22        // https://docs.microsoft.com/rest/api/searchservice/Custom-analyzers-in-Azure-Search
 23
 24        /// <summary>
 25        /// A character filter that attempts to strip out HTML constructs.
 26        /// <see href="https://lucene.apache.org/core/4_10_3/analyzers-common/org/apache/lucene/analysis/charfilter/HTML
 27        /// </summary>
 228        public static readonly CharFilterName HtmlStrip = new CharFilterName("html_strip");
 29
 30        private CharFilterName(string name)
 31        {
 1232            Throw.IfArgumentNull(name, nameof(name));
 1233            _value = name;
 1234        }
 35
 36        /// <summary>
 37        /// Defines implicit conversion from string to CharFilterName.
 38        /// </summary>
 39        /// <param name="name">string to convert.</param>
 40        /// <returns>The string as a CharFilterName.</returns>
 441        public static implicit operator CharFilterName(string name) => new CharFilterName(name);
 42
 43        /// <summary>
 44        /// Defines explicit conversion from CharFilterName to string.
 45        /// </summary>
 46        /// <param name="name">CharFilterName to convert.</param>
 47        /// <returns>The CharFilterName as a string.</returns>
 048        public static explicit operator string(CharFilterName name) => name.ToString();
 49
 50        /// <summary>
 51        /// Compares two CharFilterName values for equality.
 52        /// </summary>
 53        /// <param name="lhs">The first CharFilterName to compare.</param>
 54        /// <param name="rhs">The second CharFilterName to compare.</param>
 55        /// <returns>true if the CharFilterName objects are equal or are both null; false otherwise.</returns>
 056        public static bool operator ==(CharFilterName lhs, CharFilterName rhs) => Equals(lhs, rhs);
 57
 58        /// <summary>
 59        /// Compares two CharFilterName values for inequality.
 60        /// </summary>
 61        /// <param name="lhs">The first CharFilterName to compare.</param>
 62        /// <param name="rhs">The second CharFilterName to compare.</param>
 63        /// <returns>true if the CharFilterName objects are not equal; false otherwise.</returns>
 064        public static bool operator !=(CharFilterName lhs, CharFilterName rhs) => !Equals(lhs, rhs);
 65
 66        /// <summary>
 67        /// Compares the CharFilterName for equality with another CharFilterName.
 68        /// </summary>
 69        /// <param name="other">The CharFilterName with which to compare.</param>
 70        /// <returns><c>true</c> if the CharFilterName objects are equal; otherwise, <c>false</c>.</returns>
 471        public bool Equals(CharFilterName other) => _value == other._value;
 72
 73        /// <summary>
 74        /// Determines whether the specified object is equal to the current object.
 75        /// </summary>
 76        /// <param name="obj">The object to compare with the current object.</param>
 77        /// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</retur
 078        public override bool Equals(object obj) => obj is CharFilterName ? Equals((CharFilterName)obj) : false;
 79
 80        /// <summary>
 81        /// Serves as the default hash function.
 82        /// </summary>
 83        /// <returns>A hash code for the current object.</returns>
 084        public override int GetHashCode() => _value.GetHashCode();
 85
 86        /// <summary>
 87        /// Returns a string representation of the CharFilterName.
 88        /// </summary>
 89        /// <returns>The CharFilterName as a string.</returns>
 1090        public override string ToString() => _value;
 91    }
 92}