< Summary

Class:Microsoft.Azure.Search.Models.NamedEntityCategoryEnumExtension
Assembly:Microsoft.Azure.Search.Service
File(s):C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Skillsets\Models\NamedEntityCategory.cs
Covered lines:0
Uncovered lines:9
Coverable lines:9
Total lines:63
Line coverage:0% (0 of 9)
Covered branches:0
Total branches:12
Branch coverage:0% (0 of 12)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\search\Microsoft.Azure.Search.Service\src\Customizations\Skillsets\Models\NamedEntityCategory.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 Newtonsoft.Json;
 8    using Newtonsoft.Json.Converters;
 9    using System;
 10    using System.Runtime.Serialization;
 11
 12    /// <summary>
 13    /// Defines values for NamedEntityCategory. This is deprecated, use <see cref="EntityCategory"/> instead
 14    /// </summary>
 15    [JsonConverter(typeof(StringEnumConverter))]
 16    [Obsolete("Use EntityCategory instead.")]
 17    public enum NamedEntityCategory
 18    {
 19        [EnumMember(Value = "location")]
 20        Location,
 21        [EnumMember(Value = "organization")]
 22        Organization,
 23        [EnumMember(Value = "person")]
 24        Person
 25    }
 26
 27    [Obsolete("Use EntityCategoryEnumExtension instead.")]
 28    internal static class NamedEntityCategoryEnumExtension
 29    {
 30        internal static string ToSerializedValue(this NamedEntityCategory? value)
 31        {
 032            return value == null ? null : ((NamedEntityCategory)value).ToSerializedValue();
 33        }
 34
 35        internal static string ToSerializedValue(this NamedEntityCategory value)
 36        {
 37            switch (value)
 38            {
 39                case NamedEntityCategory.Location:
 040                    return "location";
 41                case NamedEntityCategory.Organization:
 042                    return "organization";
 43                case NamedEntityCategory.Person:
 044                    return "person";
 45            }
 046            return null;
 47        }
 48
 49        internal static NamedEntityCategory? ParseNamedEntityCategory(this string value)
 50        {
 51            switch (value)
 52            {
 53                case "location":
 054                    return NamedEntityCategory.Location;
 55                case "organization":
 056                    return NamedEntityCategory.Organization;
 57                case "person":
 058                    return NamedEntityCategory.Person;
 59            }
 060            return null;
 61        }
 62    }
 63}