< Summary

Class:Azure.ResourceManager.Resources.Models.Alias
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\Alias.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\Alias.Serialization.cs
Covered lines:36
Uncovered lines:9
Coverable lines:45
Total lines:132
Line coverage:80% (36 of 45)
Covered branches:23
Total branches:26
Branch coverage:88.4% (23 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
.ctor(...)-100%100%
get_Name()-100%100%
get_Paths()-100%100%
get_Type()-0%100%
get_DefaultPath()-0%100%
get_DefaultPattern()-0%100%
DeserializeAlias(...)-87.1%88.46%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\Alias.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9
 10namespace Azure.ResourceManager.Resources.Models
 11{
 12    /// <summary> The alias type. </summary>
 13    public partial class Alias
 14    {
 15        /// <summary> Initializes a new instance of Alias. </summary>
 016        internal Alias()
 17        {
 018        }
 19
 20        /// <summary> Initializes a new instance of Alias. </summary>
 21        /// <param name="name"> The alias name. </param>
 22        /// <param name="paths"> The paths for an alias. </param>
 23        /// <param name="type"> The type of the alias. </param>
 24        /// <param name="defaultPath"> The default path for an alias. </param>
 25        /// <param name="defaultPattern"> The default pattern for an alias. </param>
 10424026        internal Alias(string name, IReadOnlyList<AliasPath> paths, AliasType? type, string defaultPath, AliasPattern de
 27        {
 10424028            Name = name;
 10424029            Paths = paths;
 10424030            Type = type;
 10424031            DefaultPath = defaultPath;
 10424032            DefaultPattern = defaultPattern;
 10424033        }
 34
 35        /// <summary> The alias name. </summary>
 1236        public string Name { get; }
 37        /// <summary> The paths for an alias. </summary>
 1638        public IReadOnlyList<AliasPath> Paths { get; }
 39        /// <summary> The type of the alias. </summary>
 040        public AliasType? Type { get; }
 41        /// <summary> The default path for an alias. </summary>
 042        public string DefaultPath { get; }
 43        /// <summary> The default pattern for an alias. </summary>
 044        public AliasPattern DefaultPattern { get; }
 45    }
 46}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\Alias.Serialization.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System.Collections.Generic;
 9using System.Text.Json;
 10using Azure.Core;
 11
 12namespace Azure.ResourceManager.Resources.Models
 13{
 14    public partial class Alias
 15    {
 16        internal static Alias DeserializeAlias(JsonElement element)
 17        {
 10424018            string name = default;
 10424019            IReadOnlyList<AliasPath> paths = default;
 10424020            AliasType? type = default;
 10424021            string defaultPath = default;
 10424022            AliasPattern defaultPattern = default;
 83393623            foreach (var property in element.EnumerateObject())
 24            {
 31272825                if (property.NameEquals("name"))
 26                {
 10424027                    if (property.Value.ValueKind == JsonValueKind.Null)
 28                    {
 29                        continue;
 30                    }
 10424031                    name = property.Value.GetString();
 10424032                    continue;
 33                }
 20848834                if (property.NameEquals("paths"))
 35                {
 10424036                    if (property.Value.ValueKind == JsonValueKind.Null)
 37                    {
 38                        continue;
 39                    }
 10424040                    List<AliasPath> array = new List<AliasPath>();
 22102441                    foreach (var item in property.Value.EnumerateArray())
 42                    {
 627243                        if (item.ValueKind == JsonValueKind.Null)
 44                        {
 045                            array.Add(null);
 46                        }
 47                        else
 48                        {
 627249                            array.Add(AliasPath.DeserializeAliasPath(item));
 50                        }
 51                    }
 10424052                    paths = array;
 10424053                    continue;
 54                }
 10424855                if (property.NameEquals("type"))
 56                {
 057                    if (property.Value.ValueKind == JsonValueKind.Null)
 58                    {
 59                        continue;
 60                    }
 061                    type = property.Value.GetString().ToAliasType();
 062                    continue;
 63                }
 10424864                if (property.NameEquals("defaultPath"))
 65                {
 10421666                    if (property.Value.ValueKind == JsonValueKind.Null)
 67                    {
 68                        continue;
 69                    }
 10421670                    defaultPath = property.Value.GetString();
 10421671                    continue;
 72                }
 3273                if (property.NameEquals("defaultPattern"))
 74                {
 3275                    if (property.Value.ValueKind == JsonValueKind.Null)
 76                    {
 77                        continue;
 78                    }
 3279                    defaultPattern = AliasPattern.DeserializeAliasPattern(property.Value);
 80                    continue;
 81                }
 82            }
 10424083            return new Alias(name, paths, type, defaultPath, defaultPattern);
 84        }
 85    }
 86}