< Summary

Class:Azure.Security.KeyVault.Certificates.IssuerParameters
Assembly:Azure.Security.KeyVault.Certificates
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\IssuerParameters.cs
Covered lines:17
Uncovered lines:4
Coverable lines:21
Total lines:63
Line coverage:80.9% (17 of 21)
Covered branches:12
Total branches:14
Branch coverage:85.7% (12 of 14)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.cctor()-100%100%
get_IssuerName()-100%100%
get_CertificateType()-0%100%
get_CertificateTransparency()-100%100%
ReadProperties(...)-75%87.5%
WriteProperties(...)-85.71%83.33%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Text.Json;
 5
 6namespace Azure.Security.KeyVault.Certificates
 7{
 8    internal struct IssuerParameters
 9    {
 10        private const string IssuerNamePropertyName = "name";
 11        private const string CertificateTypePropertyName = "cty";
 12        private const string CertificateTransparencyPropertyName = "cert_transparency";
 13
 214        private static readonly JsonEncodedText s_issuerNamePropertyNameBytes = JsonEncodedText.Encode(IssuerNamePropert
 215        private static readonly JsonEncodedText s_certificateTypePropertyNameBytes = JsonEncodedText.Encode(CertificateT
 216        private static readonly JsonEncodedText s_certificateTransparencyPropertyNameNameBytes = JsonEncodedText.Encode(
 17
 117418        internal string IssuerName { get; set; }
 19
 020        internal string CertificateType { get; set; }
 21
 29222        internal bool? CertificateTransparency { get; set; }
 23
 24        internal void ReadProperties(JsonElement json)
 25        {
 336826            foreach (JsonProperty prop in json.EnumerateObject())
 27            {
 87228                switch (prop.Name)
 29                {
 30                    case IssuerNamePropertyName:
 81231                        IssuerName = prop.Value.GetString();
 81232                        break;
 33
 34                    case CertificateTypePropertyName:
 035                        CertificateType = prop.Value.GetString();
 036                        break;
 37
 38                    case CertificateTransparencyPropertyName:
 6039                        CertificateTransparency = prop.Value.GetBoolean();
 40                        break;
 41                }
 42            }
 81243        }
 44
 45        internal void WriteProperties(Utf8JsonWriter json)
 46        {
 7447            if (IssuerName != null)
 48            {
 7449                json.WriteString(s_issuerNamePropertyNameBytes, IssuerName);
 50            }
 51
 7452            if (CertificateType != null)
 53            {
 054                json.WriteString(s_certificateTypePropertyNameBytes, CertificateType);
 55            }
 56
 7457            if (CertificateTransparency.HasValue)
 58            {
 6059                json.WriteBoolean(s_certificateTransparencyPropertyNameNameBytes, CertificateTransparency.Value);
 60            }
 7461        }
 62    }
 63}