< Summary

Class:Azure.Security.KeyVault.Certificates.DeletedCertificate
Assembly:Azure.Security.KeyVault.Certificates
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\DeletedCertificate.cs
Covered lines:12
Uncovered lines:3
Coverable lines:15
Total lines:65
Line coverage:80% (12 of 15)
Covered branches:7
Total branches:10
Branch coverage:70% (7 of 10)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
get_RecoveryId()-100%50%
set_RecoveryId(...)-0%0%
get_DeletedOn()-0%100%
get_ScheduledPurgeDate()-0%100%
ReadProperty(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\DeletedCertificate.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    /// A deleted <see cref="KeyVaultCertificateWithPolicy"/>.
 11    /// </summary>
 12    public class DeletedCertificate : KeyVaultCertificateWithPolicy
 13    {
 14        private const string RecoveryIdPropertyName = "recoveryId";
 15        private const string ScheduledPurgeDatePropertyName = "scheduledPurgeDate";
 16        private const string DeletedOnPropertyName = "deletedDate";
 17
 18        private string _recoveryId;
 19
 820        internal DeletedCertificate(CertificateProperties properties = null) : base(properties)
 21        {
 822        }
 23
 24        /// <summary>
 25        /// Gets the identifier of the deleted certificate.
 26        /// </summary>
 27        public Uri RecoveryId
 28        {
 1629            get => _recoveryId is null ? null : new Uri(_recoveryId);
 030            internal set => _recoveryId = value?.ToString();
 31        }
 32
 33        /// <summary>
 34        /// Gets a <see cref="DateTimeOffset"/> indicating when the certificate was deleted.
 35        /// </summary>
 036        public DateTimeOffset? DeletedOn { get; internal set; }
 37
 38        /// <summary>
 39        /// Gets a <see cref="DateTimeOffset"/> for when the deleted certificate will be purged.
 40        /// </summary>
 041        public DateTimeOffset? ScheduledPurgeDate { get; internal set; }
 42
 43        internal override void ReadProperty(JsonProperty prop)
 44        {
 8845            switch (prop.Name)
 46            {
 47                case RecoveryIdPropertyName:
 848                    _recoveryId = prop.Value.GetString();
 849                    break;
 50
 51                case DeletedOnPropertyName:
 852                    DeletedOn = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64());
 853                    break;
 54
 55                case ScheduledPurgeDatePropertyName:
 856                    ScheduledPurgeDate = DateTimeOffset.FromUnixTimeSeconds(prop.Value.GetInt64());
 857                    break;
 58
 59                default:
 6460                    base.ReadProperty(prop);
 61                    break;
 62            }
 6463        }
 64    }
 65}