< Summary

Class:Azure.ResourceManager.Compute.Models.Plan
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Plan.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Plan.Serialization.cs
Covered lines:19
Uncovered lines:29
Coverable lines:48
Total lines:129
Line coverage:39.5% (19 of 48)
Covered branches:7
Total branches:26
Branch coverage:26.9% (7 of 26)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_Name()-100%100%
get_Publisher()-100%100%
get_Product()-100%100%
get_PromotionCode()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-86.67%87.5%
DeserializePlan(...)-0%0%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Plan.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
 8namespace Azure.ResourceManager.Compute.Models
 9{
 10    /// <summary> Specifies information about the marketplace image used to create the virtual machine. This element is 
 11    public partial class Plan
 12    {
 13        /// <summary> Initializes a new instance of Plan. </summary>
 814        public Plan()
 15        {
 816        }
 17
 18        /// <summary> Initializes a new instance of Plan. </summary>
 19        /// <param name="name"> The plan ID. </param>
 20        /// <param name="publisher"> The publisher ID. </param>
 21        /// <param name="product"> Specifies the product of the image from the marketplace. This is the same value as Of
 22        /// <param name="promotionCode"> The promotion code. </param>
 023        internal Plan(string name, string publisher, string product, string promotionCode)
 24        {
 025            Name = name;
 026            Publisher = publisher;
 027            Product = product;
 028            PromotionCode = promotionCode;
 029        }
 30
 31        /// <summary> The plan ID. </summary>
 2432        public string Name { get; set; }
 33        /// <summary> The publisher ID. </summary>
 2434        public string Publisher { get; set; }
 35        /// <summary> Specifies the product of the image from the marketplace. This is the same value as Offer under the
 2436        public string Product { get; set; }
 37        /// <summary> The promotion code. </summary>
 1638        public string PromotionCode { get; set; }
 39    }
 40}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\Plan.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.Text.Json;
 9using Azure.Core;
 10
 11namespace Azure.ResourceManager.Compute.Models
 12{
 13    public partial class Plan : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 817            writer.WriteStartObject();
 818            if (Name != null)
 19            {
 820                writer.WritePropertyName("name");
 821                writer.WriteStringValue(Name);
 22            }
 823            if (Publisher != null)
 24            {
 825                writer.WritePropertyName("publisher");
 826                writer.WriteStringValue(Publisher);
 27            }
 828            if (Product != null)
 29            {
 830                writer.WritePropertyName("product");
 831                writer.WriteStringValue(Product);
 32            }
 833            if (PromotionCode != null)
 34            {
 035                writer.WritePropertyName("promotionCode");
 036                writer.WriteStringValue(PromotionCode);
 37            }
 838            writer.WriteEndObject();
 839        }
 40
 41        internal static Plan DeserializePlan(JsonElement element)
 42        {
 043            string name = default;
 044            string publisher = default;
 045            string product = default;
 046            string promotionCode = default;
 047            foreach (var property in element.EnumerateObject())
 48            {
 049                if (property.NameEquals("name"))
 50                {
 051                    if (property.Value.ValueKind == JsonValueKind.Null)
 52                    {
 53                        continue;
 54                    }
 055                    name = property.Value.GetString();
 056                    continue;
 57                }
 058                if (property.NameEquals("publisher"))
 59                {
 060                    if (property.Value.ValueKind == JsonValueKind.Null)
 61                    {
 62                        continue;
 63                    }
 064                    publisher = property.Value.GetString();
 065                    continue;
 66                }
 067                if (property.NameEquals("product"))
 68                {
 069                    if (property.Value.ValueKind == JsonValueKind.Null)
 70                    {
 71                        continue;
 72                    }
 073                    product = property.Value.GetString();
 074                    continue;
 75                }
 076                if (property.NameEquals("promotionCode"))
 77                {
 078                    if (property.Value.ValueKind == JsonValueKind.Null)
 79                    {
 80                        continue;
 81                    }
 082                    promotionCode = property.Value.GetString();
 83                    continue;
 84                }
 85            }
 086            return new Plan(name, publisher, product, promotionCode);
 87        }
 88    }
 89}