< Summary

Class:Microsoft.Azure.CognitiveServices.Search.VideoSearch.Models.ErrorCodeEnumExtension
Assembly:Microsoft.Azure.CognitiveServices.Search.BingVideoSearch
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingVideoSearch\src\Generated\VideoSearch\Models\ErrorCode.cs
Covered lines:0
Uncovered lines:15
Coverable lines:15
Total lines:80
Line coverage:0% (0 of 15)
Covered branches:0
Total branches:21
Branch coverage:0% (0 of 21)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
ToSerializedValue(...)-0%0%
ToSerializedValue(...)-0%0%
ParseErrorCode(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\Search.BingVideoSearch\src\Generated\VideoSearch\Models\ErrorCode.cs

#LineLine coverage
 1// <auto-generated>
 2// Code generated by Microsoft (R) AutoRest Code Generator.
 3// Changes may cause incorrect behavior and will be lost if the code is
 4// regenerated.
 5// </auto-generated>
 6
 7namespace Microsoft.Azure.CognitiveServices.Search.VideoSearch.Models
 8{
 9    using Newtonsoft.Json;
 10    using Newtonsoft.Json.Converters;
 11    using System.Runtime;
 12    using System.Runtime.Serialization;
 13
 14    /// <summary>
 15    /// Defines values for ErrorCode.
 16    /// </summary>
 17    [JsonConverter(typeof(StringEnumConverter))]
 18    public enum ErrorCode
 19    {
 20        [EnumMember(Value = "None")]
 21        None,
 22        [EnumMember(Value = "ServerError")]
 23        ServerError,
 24        [EnumMember(Value = "InvalidRequest")]
 25        InvalidRequest,
 26        [EnumMember(Value = "RateLimitExceeded")]
 27        RateLimitExceeded,
 28        [EnumMember(Value = "InvalidAuthorization")]
 29        InvalidAuthorization,
 30        [EnumMember(Value = "InsufficientAuthorization")]
 31        InsufficientAuthorization
 32    }
 33    internal static class ErrorCodeEnumExtension
 34    {
 35        internal static string ToSerializedValue(this ErrorCode? value)
 36        {
 037            return value == null ? null : ((ErrorCode)value).ToSerializedValue();
 38        }
 39
 40        internal static string ToSerializedValue(this ErrorCode value)
 41        {
 42            switch( value )
 43            {
 44                case ErrorCode.None:
 045                    return "None";
 46                case ErrorCode.ServerError:
 047                    return "ServerError";
 48                case ErrorCode.InvalidRequest:
 049                    return "InvalidRequest";
 50                case ErrorCode.RateLimitExceeded:
 051                    return "RateLimitExceeded";
 52                case ErrorCode.InvalidAuthorization:
 053                    return "InvalidAuthorization";
 54                case ErrorCode.InsufficientAuthorization:
 055                    return "InsufficientAuthorization";
 56            }
 057            return null;
 58        }
 59
 60        internal static ErrorCode? ParseErrorCode(this string value)
 61        {
 62            switch( value )
 63            {
 64                case "None":
 065                    return ErrorCode.None;
 66                case "ServerError":
 067                    return ErrorCode.ServerError;
 68                case "InvalidRequest":
 069                    return ErrorCode.InvalidRequest;
 70                case "RateLimitExceeded":
 071                    return ErrorCode.RateLimitExceeded;
 72                case "InvalidAuthorization":
 073                    return ErrorCode.InvalidAuthorization;
 74                case "InsufficientAuthorization":
 075                    return ErrorCode.InsufficientAuthorization;
 76            }
 077            return null;
 78        }
 79    }
 80}