< Summary

Class:Azure.Security.KeyVault.Certificates.IssuerProperties
Assembly:Azure.Security.KeyVault.Certificates
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\IssuerProperties.cs
Covered lines:22
Uncovered lines:1
Coverable lines:23
Total lines:77
Line coverage:95.6% (22 of 23)
Covered branches:7
Total branches:8
Branch coverage:87.5% (7 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.cctor()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
get_Id()-100%100%
get_Name()-100%100%
get_Provider()-100%100%
Azure.Security.KeyVault.IJsonDeserializable.ReadProperties(...)-100%100%
ReadProperty(...)-100%75%
Azure.Security.KeyVault.IJsonSerializable.WriteProperties(...)-0%100%
WriteProperties(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\IssuerProperties.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Text.Json;
 6
 7namespace Azure.Security.KeyVault.Certificates
 8{
 9    /// <summary>
 10    /// Properties of a <see cref="CertificateIssuer"/>.
 11    /// </summary>
 12    public class IssuerProperties : IJsonDeserializable, IJsonSerializable
 13    {
 14        private const string IdPropertyName = "id";
 15        private const string ProviderPropertyName = "provider";
 16
 217        private static readonly JsonEncodedText s_providerPropertyNameBytes = JsonEncodedText.Encode(ProviderPropertyNam
 18
 6819        internal IssuerProperties()
 20        {
 6821        }
 22
 3223        internal IssuerProperties(string name)
 24        {
 3225            Name = name;
 3226        }
 27
 28        /// <summary>
 29        /// Gets the identifier of the certificate issuer.
 30        /// </summary>
 46831        public Uri Id { get; internal set; }
 32
 33        /// <summary>
 34        /// Gets the name of the certificate issuer.
 35        /// </summary>
 17636        public string Name { get; internal set; }
 37
 38        /// <summary>
 39        /// Gets or sets the provider name of the certificate issuer.
 40        /// </summary>
 22841        public string Provider { get; set; }
 42
 43        void IJsonDeserializable.ReadProperties(JsonElement json)
 44        {
 14445            foreach (JsonProperty prop in json.EnumerateObject())
 46            {
 4847                ReadProperty(prop);
 48            }
 2449        }
 50
 51        internal void ReadProperty(JsonProperty prop)
 52        {
 11853            switch (prop.Name)
 54            {
 55                case IdPropertyName:
 5856                    var id = prop.Value.GetString();
 5857                    Id = new Uri(id);
 5858                    Name = Id.Segments[Id.Segments.Length - 1];
 5859                    break;
 60
 61                case ProviderPropertyName:
 6062                    Provider = prop.Value.GetString();
 63                    break;
 64            }
 6065        }
 66
 067        void IJsonSerializable.WriteProperties(Utf8JsonWriter json) => WriteProperties(json);
 68
 69        internal void WriteProperties(Utf8JsonWriter json)
 70        {
 2871            if (!string.IsNullOrEmpty(Provider))
 72            {
 2873                json.WriteString(s_providerPropertyNameBytes, Provider);
 74            }
 2875        }
 76    }
 77}