< Summary

Class:Azure.Security.KeyVault.Certificates.CertificateOperationError
Assembly:Azure.Security.KeyVault.Certificates
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\CertificateOperationError.cs
Covered lines:10
Uncovered lines:4
Coverable lines:14
Total lines:58
Line coverage:71.4% (10 of 14)
Covered branches:6
Total branches:8
Branch coverage:75% (6 of 8)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
get_Code()-0%100%
get_Message()-100%100%
get_InnerError()-0%100%
Azure.Security.KeyVault.IJsonDeserializable.ReadProperties(...)-77.78%75%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\CertificateOperationError.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    /// <summary>
 9    /// An error encountered during the processing of a <see cref="CertificateOperation"/>.
 10    /// </summary>
 11    public class CertificateOperationError : IJsonDeserializable
 12    {
 13        private const string CodePropertyName = "code";
 14        private const string MessagePropertyName = "message";
 15        private const string InnerErrorPropertyName = "innererror";
 16
 417        internal CertificateOperationError()
 18        {
 419        }
 20
 21        /// <summary>
 22        /// Gets the error code of the specified error.
 23        /// </summary>
 024        public string Code { get; internal set; }
 25
 26        /// <summary>
 27        /// Gets a message containing details of the encountered error.
 28        /// </summary>
 829        public string Message { get; internal set; }
 30
 31        /// <summary>
 32        /// Gets an underlying error - if one exists - for the current error.
 33        /// </summary>
 034        public CertificateOperationError InnerError { get; internal set; }
 35
 36        void IJsonDeserializable.ReadProperties(JsonElement json)
 37        {
 2438            foreach (JsonProperty prop in json.EnumerateObject())
 39            {
 840                switch (prop.Name)
 41                {
 42                    case CodePropertyName:
 443                        Code = prop.Value.GetString();
 444                        break;
 45
 46                    case MessagePropertyName:
 447                        Message = prop.Value.GetString();
 448                        break;
 49
 50                    case InnerErrorPropertyName:
 051                        InnerError = new CertificateOperationError();
 052                        ((IJsonDeserializable)InnerError).ReadProperties(prop.Value);
 53                        break;
 54                }
 55            }
 456        }
 57    }
 58}