< Summary

Class:Microsoft.Azure.CognitiveServices.AnomalyDetector.Models.GranularityEnumExtension
Assembly:Microsoft.Azure.CognitiveServices.AnomalyDetector
File(s):C:\Git\azure-sdk-for-net\sdk\cognitiveservices\AnomalyDetector\src\Generated\Models\Granularity.cs
Covered lines:0
Uncovered lines:15
Coverable lines:15
Total lines:84
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%
ParseGranularity(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\cognitiveservices\AnomalyDetector\src\Generated\Models\Granularity.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.CognitiveServices.AnomalyDetector.Models
 12{
 13    using Newtonsoft.Json;
 14    using Newtonsoft.Json.Converters;
 15    using System.Runtime;
 16    using System.Runtime.Serialization;
 17
 18    /// <summary>
 19    /// Defines values for Granularity.
 20    /// </summary>
 21    [JsonConverter(typeof(StringEnumConverter))]
 22    public enum Granularity
 23    {
 24        [EnumMember(Value = "yearly")]
 25        Yearly,
 26        [EnumMember(Value = "monthly")]
 27        Monthly,
 28        [EnumMember(Value = "weekly")]
 29        Weekly,
 30        [EnumMember(Value = "daily")]
 31        Daily,
 32        [EnumMember(Value = "hourly")]
 33        Hourly,
 34        [EnumMember(Value = "minutely")]
 35        Minutely
 36    }
 37    internal static class GranularityEnumExtension
 38    {
 39        internal static string ToSerializedValue(this Granularity? value)
 40        {
 041            return value == null ? null : ((Granularity)value).ToSerializedValue();
 42        }
 43
 44        internal static string ToSerializedValue(this Granularity value)
 45        {
 46            switch( value )
 47            {
 48                case Granularity.Yearly:
 049                    return "yearly";
 50                case Granularity.Monthly:
 051                    return "monthly";
 52                case Granularity.Weekly:
 053                    return "weekly";
 54                case Granularity.Daily:
 055                    return "daily";
 56                case Granularity.Hourly:
 057                    return "hourly";
 58                case Granularity.Minutely:
 059                    return "minutely";
 60            }
 061            return null;
 62        }
 63
 64        internal static Granularity? ParseGranularity(this string value)
 65        {
 66            switch( value )
 67            {
 68                case "yearly":
 069                    return Granularity.Yearly;
 70                case "monthly":
 071                    return Granularity.Monthly;
 72                case "weekly":
 073                    return Granularity.Weekly;
 74                case "daily":
 075                    return Granularity.Daily;
 76                case "hourly":
 077                    return Granularity.Hourly;
 78                case "minutely":
 079                    return Granularity.Minutely;
 80            }
 081            return null;
 82        }
 83    }
 84}