< Summary

Class:Azure.ResourceManager.Compute.Models.PurchasePlan
Assembly:Azure.ResourceManager.Compute
File(s):C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\PurchasePlan.cs
C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\PurchasePlan.Serialization.cs
Covered lines:24
Uncovered lines:12
Coverable lines:36
Total lines:99
Line coverage:66.6% (24 of 36)
Covered branches:11
Total branches:14
Branch coverage:78.5% (11 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-72.73%50%
get_Publisher()-100%100%
get_Name()-100%100%
get_Product()-100%100%
Azure.Core.IUtf8JsonSerializable.Write(...)-0%100%
DeserializePurchasePlan(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\PurchasePlan.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;
 9
 10namespace Azure.ResourceManager.Compute.Models
 11{
 12    /// <summary> Used for establishing the purchase context of any 3rd Party artifact through MarketPlace. </summary>
 13    public partial class PurchasePlan
 14    {
 15        /// <summary> Initializes a new instance of PurchasePlan. </summary>
 16        /// <param name="publisher"> The publisher ID. </param>
 17        /// <param name="name"> The plan ID. </param>
 18        /// <param name="product"> Specifies the product of the image from the marketplace. This is the same value as Of
 819        public PurchasePlan(string publisher, string name, string product)
 20        {
 821            if (publisher == null)
 22            {
 023                throw new ArgumentNullException(nameof(publisher));
 24            }
 825            if (name == null)
 26            {
 027                throw new ArgumentNullException(nameof(name));
 28            }
 829            if (product == null)
 30            {
 031                throw new ArgumentNullException(nameof(product));
 32            }
 33
 834            Publisher = publisher;
 835            Name = name;
 836            Product = product;
 837        }
 38
 39        /// <summary> The publisher ID. </summary>
 1640        public string Publisher { get; set; }
 41        /// <summary> The plan ID. </summary>
 1642        public string Name { get; set; }
 43        /// <summary> Specifies the product of the image from the marketplace. This is the same value as Offer under the
 1644        public string Product { get; set; }
 45    }
 46}

C:\Git\azure-sdk-for-net\sdk\compute\Azure.ResourceManager.Compute\src\Generated\Models\PurchasePlan.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 PurchasePlan : IUtf8JsonSerializable
 14    {
 15        void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
 16        {
 017            writer.WriteStartObject();
 018            writer.WritePropertyName("publisher");
 019            writer.WriteStringValue(Publisher);
 020            writer.WritePropertyName("name");
 021            writer.WriteStringValue(Name);
 022            writer.WritePropertyName("product");
 023            writer.WriteStringValue(Product);
 024            writer.WriteEndObject();
 025        }
 26
 27        internal static PurchasePlan DeserializePurchasePlan(JsonElement element)
 28        {
 829            string publisher = default;
 830            string name = default;
 831            string product = default;
 6432            foreach (var property in element.EnumerateObject())
 33            {
 2434                if (property.NameEquals("publisher"))
 35                {
 836                    publisher = property.Value.GetString();
 837                    continue;
 38                }
 1639                if (property.NameEquals("name"))
 40                {
 841                    name = property.Value.GetString();
 842                    continue;
 43                }
 844                if (property.NameEquals("product"))
 45                {
 846                    product = property.Value.GetString();
 47                    continue;
 48                }
 49            }
 850            return new PurchasePlan(publisher, name, product);
 51        }
 52    }
 53}