< Summary

Class:Azure.AI.TextAnalytics.TextAnalyticsWarningCode
Assembly:Azure.AI.TextAnalytics
File(s):C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\TextAnalyticsWarningCode.cs
Covered lines:7
Uncovered lines:6
Coverable lines:13
Total lines:91
Line coverage:53.8% (7 of 13)
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(...)-0%100%
Equals(...)-0%0%
GetHashCode()-0%100%
ToString()-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\textanalytics\Azure.AI.TextAnalytics\src\TextAnalyticsWarningCode.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.ComponentModel;
 6using Azure.Core;
 7
 8namespace Azure.AI.TextAnalytics
 9{
 10    /// <summary>
 11    /// Text Analytics warning code values.
 12    /// </summary>
 13    public readonly struct TextAnalyticsWarningCode : IEquatable<TextAnalyticsWarningCode>
 14    {
 15        private readonly string _value;
 16
 17        /// <summary>
 18        /// Specifies that the warning code is long words in document.
 19        /// </summary>
 220        public static readonly string LongWordsInDocument = "LongWordsInDocument";
 21
 22        /// <summary>
 23        /// Specifies that the warning code is a document truncated.
 24        /// </summary>
 225        public static readonly string DocumentTruncated = "DocumentTruncated";
 26
 27        private TextAnalyticsWarningCode(string warningCode)
 28        {
 429            Argument.AssertNotNullOrEmpty(warningCode, nameof(warningCode));
 430            _value = warningCode;
 431        }
 32
 33        /// <summary>
 34        /// Defines implicit conversion from string to TextAnalyticsWarningCode.
 35        /// </summary>
 36        /// <param name="warningCode">string to convert.</param>
 37        /// <returns>The string as an TextAnalyticsWarningCode.</returns>
 438        public static implicit operator TextAnalyticsWarningCode(string warningCode) => new TextAnalyticsWarningCode(war
 39
 40        /// <summary>
 41        /// Defines explicit conversion from TextAnalyticsWarningCode to string.
 42        /// </summary>
 43        /// <param name="warningCode">TextAnalyticsWarningCode to convert.</param>
 44        /// <returns>The TextAnalyticsWarningCode as a string.</returns>
 045        public static explicit operator string(TextAnalyticsWarningCode warningCode) => warningCode._value;
 46
 47        /// <summary>
 48        /// Compares two TextAnalyticsWarningCode values for equality.
 49        /// </summary>
 50        /// <param name="left">The first TextAnalyticsWarningCode to compare.</param>
 51        /// <param name="right">The second TextAnalyticsWarningCode to compare.</param>
 52        /// <returns>true if the TextAnalyticsWarningCode objects are equal or are both null; false otherwise.</returns>
 053        public static bool operator ==(TextAnalyticsWarningCode left, TextAnalyticsWarningCode right) => Equals(left, ri
 54
 55        /// <summary>
 56        /// Compares two TextAnalyticsWarningCode values for inequality.
 57        /// </summary>
 58        /// <param name="left">The first TextAnalyticsWarningCode to compare.</param>
 59        /// <param name="right">The second TextAnalyticsWarningCode to compare.</param>
 60        /// <returns>true if the TextAnalyticsWarningCode objects are not equal; false otherwise.</returns>
 061        public static bool operator !=(TextAnalyticsWarningCode left, TextAnalyticsWarningCode right) => !Equals(left, r
 62
 63        /// <summary>
 64        /// Compares the TextAnalyticsWarningCode for equality with another TextAnalyticsWarningCode.
 65        /// </summary>
 66        /// <param name="other">The TextAnalyticsWarningCode with which to compare.</param>
 67        /// <returns><c>true</c> if the TextAnalyticsWarningCode objects are equal; otherwise, <c>false</c>.</returns>
 068        public bool Equals(TextAnalyticsWarningCode other) => _value == other._value;
 69
 70        /// <summary>
 71        /// Determines whether the specified object is equal to the current object.
 72        /// </summary>
 73        /// <param name="obj">The object to compare with the current object.</param>
 74        /// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</retur
 75        [EditorBrowsable(EditorBrowsableState.Never)]
 076        public override bool Equals(object obj) => obj is TextAnalyticsWarningCode warningCode && Equals(warningCode);
 77
 78        /// <summary>
 79        /// Serves as the default hash function.
 80        /// </summary>
 81        /// <returns>A hash code for the current object.</returns>
 82        [EditorBrowsable(EditorBrowsableState.Never)]
 083        public override int GetHashCode() => _value.GetHashCode();
 84
 85        /// <summary>
 86        /// Returns a string representation of the TextAnalyticsWarningCode.
 87        /// </summary>
 88        /// <returns>The TextAnalyticsWarningCode as a string.</returns>
 489        public override string ToString() => _value;
 90    }
 91}