< Summary

Class:Azure.ResourceManager.Compute.Models.Gallery
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Gallery.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Gallery.Serialization.cs
Covered lines:67
Uncovered lines:25
Coverable lines:92
Total lines:220
Line coverage:72.8% (67 of 92)
Covered branches:43
Total branches:58
Branch coverage:74.1% (43 of 58)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-75%50%
.ctor(...)-100%100%
get_Description()-100%100%
get_Identifier()-100%100%
get_ProvisioningState()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-51.52%50%
DeserializeGallery(...)-82.98%85%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Gallery.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;
 9using System.Collections.Generic;
 10
 11namespace Azure.ResourceManager.Compute.Models
 12{
 13    /// <summary> Specifies information about the Shared Image Gallery that you want to create or update. </summary>
 14    public partial class Gallery : Resource
 15    {
 16        /// <summary> Initializes a new instance of Gallery. </summary>
 17        /// <param name="location"> Resource location. </param>
 1618        public Gallery(string location) : base(location)
 19        {
 1620            if (location == null)
 21            {
 022                throw new ArgumentNullException(nameof(location));
 23            }
 1624        }
 25
 26        /// <summary> Initializes a new instance of Gallery. </summary>
 27        /// <param name="id"> Resource Id. </param>
 28        /// <param name="name"> Resource name. </param>
 29        /// <param name="type"> Resource type. </param>
 30        /// <param name="location"> Resource location. </param>
 31        /// <param name="tags"> Resource tags. </param>
 32        /// <param name="description"> The description of this Shared Image Gallery resource. This property is updatable
 33        /// <param name="identifier"> Describes the gallery unique name. </param>
 34        /// <param name="provisioningState"> The provisioning state, which only appears in the response. </param>
 5435        internal Gallery(string id, string name, string type, string location, IDictionary<string, string> tags, string 
 36        {
 5437            Description = description;
 5438            Identifier = identifier;
 5439            ProvisioningState = provisioningState;
 5440        }
 41
 42        /// <summary> The description of this Shared Image Gallery resource. This property is updatable. </summary>
 19443        public string Description { get; set; }
 44        /// <summary> Describes the gallery unique name. </summary>
 11045        public GalleryIdentifier Identifier { get; set; }
 46        /// <summary> The provisioning state, which only appears in the response. </summary>
 5647        public GalleryPropertiesProvisioningState? ProvisioningState { get; }
 48    }
 49}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Gallery.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.Compute.Models
 13{
 14    public partial class Gallery : IUtf8JsonSerializable
 15    {
 16        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 17        {
 4818            writer.WriteStartObject();
 4819            if (Id != null)
 20            {
 021                writer.WritePropertyName("id");
 022                writer.WriteStringValue(Id);
 23            }
 4824            if (Name != null)
 25            {
 026                writer.WritePropertyName("name");
 027                writer.WriteStringValue(Name);
 28            }
 4829            if (Type != null)
 30            {
 031                writer.WritePropertyName("type");
 032                writer.WriteStringValue(Type);
 33            }
 4834            writer.WritePropertyName("location");
 4835            writer.WriteStringValue(Location);
 4836            if (Tags != null)
 37            {
 038                writer.WritePropertyName("tags");
 039                writer.WriteStartObject();
 040                foreach (var item in Tags)
 41                {
 042                    writer.WritePropertyName(item.Key);
 043                    writer.WriteStringValue(item.Value);
 44                }
 045                writer.WriteEndObject();
 46            }
 4847            writer.WritePropertyName("properties");
 4848            writer.WriteStartObject();
 4849            if (Description != null)
 50            {
 4851                writer.WritePropertyName("description");
 4852                writer.WriteStringValue(Description);
 53            }
 4854            if (Identifier != null)
 55            {
 056                writer.WritePropertyName("identifier");
 057                writer.WriteObjectValue(Identifier);
 58            }
 4859            if (ProvisioningState != null)
 60            {
 061                writer.WritePropertyName("provisioningState");
 062                writer.WriteStringValue(ProvisioningState.Value.ToString());
 63            }
 4864            writer.WriteEndObject();
 4865            writer.WriteEndObject();
 4866        }
 67
 68        internal static Gallery DeserializeGallery(JsonElement element)
 69        {
 5470            string id = default;
 5471            string name = default;
 5472            string type = default;
 5473            string location = default;
 5474            IDictionary<string, string> tags = default;
 5475            string description = default;
 5476            GalleryIdentifier identifier = default;
 5477            GalleryPropertiesProvisioningState? provisioningState = default;
 64878            foreach (var property in element.EnumerateObject())
 79            {
 27080                if (property.NameEquals("id"))
 81                {
 5482                    if (property.Value.ValueKind == JsonValueKind.Null)
 83                    {
 84                        continue;
 85                    }
 5486                    id = property.Value.GetString();
 5487                    continue;
 88                }
 21689                if (property.NameEquals("name"))
 90                {
 5491                    if (property.Value.ValueKind == JsonValueKind.Null)
 92                    {
 93                        continue;
 94                    }
 5495                    name = property.Value.GetString();
 5496                    continue;
 97                }
 16298                if (property.NameEquals("type"))
 99                {
 54100                    if (property.Value.ValueKind == JsonValueKind.Null)
 101                    {
 102                        continue;
 103                    }
 54104                    type = property.Value.GetString();
 54105                    continue;
 106                }
 108107                if (property.NameEquals("location"))
 108                {
 54109                    location = property.Value.GetString();
 54110                    continue;
 111                }
 54112                if (property.NameEquals("tags"))
 113                {
 0114                    if (property.Value.ValueKind == JsonValueKind.Null)
 115                    {
 116                        continue;
 117                    }
 0118                    Dictionary<string, string> dictionary = new Dictionary<string, string>();
 0119                    foreach (var property0 in property.Value.EnumerateObject())
 120                    {
 0121                        if (property0.Value.ValueKind == JsonValueKind.Null)
 122                        {
 0123                            dictionary.Add(property0.Name, null);
 124                        }
 125                        else
 126                        {
 0127                            dictionary.Add(property0.Name, property0.Value.GetString());
 128                        }
 129                    }
 0130                    tags = dictionary;
 0131                    continue;
 132                }
 54133                if (property.NameEquals("properties"))
 134                {
 432135                    foreach (var property0 in property.Value.EnumerateObject())
 136                    {
 162137                        if (property0.NameEquals("description"))
 138                        {
 54139                            if (property0.Value.ValueKind == JsonValueKind.Null)
 140                            {
 141                                continue;
 142                            }
 54143                            description = property0.Value.GetString();
 54144                            continue;
 145                        }
 108146                        if (property0.NameEquals("identifier"))
 147                        {
 54148                            if (property0.Value.ValueKind == JsonValueKind.Null)
 149                            {
 150                                continue;
 151                            }
 54152                            identifier = GalleryIdentifier.DeserializeGalleryIdentifier(property0.Value);
 54153                            continue;
 154                        }
 54155                        if (property0.NameEquals("provisioningState"))
 156                        {
 54157                            if (property0.Value.ValueKind == JsonValueKind.Null)
 158                            {
 159                                continue;
 160                            }
 54161                            provisioningState = new GalleryPropertiesProvisioningState(property0.Value.GetString());
 162                            continue;
 163                        }
 164                    }
 165                    continue;
 166                }
 167            }
 54168            return new Gallery(id, name, type, location, tags, description, identifier, provisioningState);
 169        }
 170    }
 171}