< Summary

Class:Azure.Security.KeyVault.Certificates.CertificateAttributes
Assembly:Azure.Security.KeyVault.Certificates
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\CertificateAttributes.cs
Covered lines:18
Uncovered lines:5
Coverable lines:23
Total lines:70
Line coverage:78.2% (18 of 23)
Covered branches:34
Total branches:34
Branch coverage:100% (34 of 34)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Enabled()-100%100%
get_NotBefore()-0%100%
get_ExpiresOn()-0%100%
get_CreatedOn()-0%100%
get_UpdatedOn()-0%100%
get_RecoverableDays()-100%100%
get_RecoveryLevel()-0%100%
ReadProperties(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\CertificateAttributes.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    internal struct CertificateAttributes
 10    {
 11        private const string EnabledPropertyName = "enabled";
 12        private const string NotBeforePropertyName = "nbf";
 13        private const string ExpiresPropertyName = "exp";
 14        private const string CreatedPropertyName = "created";
 15        private const string UpdatedPropertyName = "updated";
 16        private const string RecoverableDaysPropertyName = "recoverableDays";
 17        private const string RecoveryLevelPropertyName = "recoveryLevel";
 18
 10819        public bool? Enabled { get; set; }
 20
 021        public DateTimeOffset? NotBefore { get; set; }
 22
 023        public DateTimeOffset? ExpiresOn { get; set; }
 24
 025        public DateTimeOffset? CreatedOn { get; internal set; }
 26
 027        public DateTimeOffset? UpdatedOn { get; internal set; }
 28
 8629        public int? RecoverableDays { get; internal set; }
 30
 031        public string RecoveryLevel { get; internal set; }
 32
 33        internal void ReadProperties(JsonElement json)
 34        {
 123235            foreach (JsonProperty prop in json.EnumerateObject())
 36            {
 53637                switch (prop.Name)
 38                {
 39                    case EnabledPropertyName:
 7640                        Enabled = prop.Value.GetBoolean();
 7641                        break;
 42
 43                    case NotBeforePropertyName:
 7644                        NotBefore = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64());
 7645                        break;
 46
 47                    case ExpiresPropertyName:
 7648                        ExpiresOn = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64());
 7649                        break;
 50
 51                    case CreatedPropertyName:
 7652                        CreatedOn = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64());
 7653                        break;
 54
 55                    case UpdatedPropertyName:
 7656                        UpdatedOn = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64());
 7657                        break;
 58
 59                    case RecoverableDaysPropertyName:
 8060                        RecoverableDays = prop.Value.GetInt32();
 8061                        break;
 62
 63                    case RecoveryLevelPropertyName:
 7664                        RecoveryLevel = prop.Value.GetString();
 65                        break;
 66                }
 67            }
 8068        }
 69    }
 70}