< Summary

Class:Azure.ResourceManager.Resources.Models.Plan
Assembly:Azure.ResourceManager.Resources
File(s):C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\Plan.cs
C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\src\Generated\Models\Plan.Serialization.cs
Covered lines:53
Uncovered lines:5
Coverable lines:58
Total lines:148
Line coverage:91.3% (53 of 58)
Covered branches:28
Total branches:32
Branch coverage:87.5% (28 of 32)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
get_Name()-100%100%
get_Publisher()-100%100%
get_Product()-100%100%
get_PromotionCode()-100%100%
get_Version()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-88.89%90%
DeserializePlan(...)-88.46%86.36%

File(s)

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\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.Resources.Models
 9{
 10    /// <summary> Plan for the resource. </summary>
 11    public partial class Plan
 12    {
 13        /// <summary> Initializes a new instance of Plan. </summary>
 414        public Plan()
 15        {
 416        }
 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"> The offer ID. </param>
 22        /// <param name="promotionCode"> The promotion code. </param>
 23        /// <param name="version"> The plan&apos;s version. </param>
 1024        internal Plan(string name, string publisher, string product, string promotionCode, string version)
 25        {
 1026            Name = name;
 1027            Publisher = publisher;
 1028            Product = product;
 1029            PromotionCode = promotionCode;
 1030            Version = version;
 1031        }
 32
 33        /// <summary> The plan ID. </summary>
 3834        public string Name { get; set; }
 35        /// <summary> The publisher ID. </summary>
 3036        public string Publisher { get; set; }
 37        /// <summary> The offer ID. </summary>
 3038        public string Product { get; set; }
 39        /// <summary> The promotion code. </summary>
 3040        public string PromotionCode { get; set; }
 41        /// <summary> The plan&apos;s version. </summary>
 1842        public string Version { get; set; }
 43    }
 44}

C:\Git\azure-sdk-for-net\sdk\resources\Azure.ResourceManager.Resources\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.Resources.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            {
 835                writer.WritePropertyName("promotionCode");
 836                writer.WriteStringValue(PromotionCode);
 37            }
 838            if (Version != null)
 39            {
 040                writer.WritePropertyName("version");
 041                writer.WriteStringValue(Version);
 42            }
 843            writer.WriteEndObject();
 844        }
 45
 46        internal static Plan DeserializePlan(JsonElement element)
 47        {
 1048            string name = default;
 1049            string publisher = default;
 1050            string product = default;
 1051            string promotionCode = default;
 1052            string version = default;
 10053            foreach (var property in element.EnumerateObject())
 54            {
 4055                if (property.NameEquals("name"))
 56                {
 1057                    if (property.Value.ValueKind == JsonValueKind.Null)
 58                    {
 59                        continue;
 60                    }
 1061                    name = property.Value.GetString();
 1062                    continue;
 63                }
 3064                if (property.NameEquals("publisher"))
 65                {
 1066                    if (property.Value.ValueKind == JsonValueKind.Null)
 67                    {
 68                        continue;
 69                    }
 1070                    publisher = property.Value.GetString();
 1071                    continue;
 72                }
 2073                if (property.NameEquals("product"))
 74                {
 1075                    if (property.Value.ValueKind == JsonValueKind.Null)
 76                    {
 77                        continue;
 78                    }
 1079                    product = property.Value.GetString();
 1080                    continue;
 81                }
 1082                if (property.NameEquals("promotionCode"))
 83                {
 1084                    if (property.Value.ValueKind == JsonValueKind.Null)
 85                    {
 86                        continue;
 87                    }
 1088                    promotionCode = property.Value.GetString();
 1089                    continue;
 90                }
 091                if (property.NameEquals("version"))
 92                {
 093                    if (property.Value.ValueKind == JsonValueKind.Null)
 94                    {
 95                        continue;
 96                    }
 097                    version = property.Value.GetString();
 98                    continue;
 99                }
 100            }
 10101            return new Plan(name, publisher, product, promotionCode, version);
 102        }
 103    }
 104}