< Summary

Class:Microsoft.Azure.KeyVault.Models.X509CertificateProperties
Assembly:Microsoft.Azure.KeyVault
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault\src\Generated\Models\X509CertificateProperties.cs
Covered lines:9
Uncovered lines:8
Coverable lines:17
Total lines:103
Line coverage:52.9% (9 of 17)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-0%100%
get_Subject()-100%100%
get_Ekus()-100%100%
get_SubjectAlternativeNames()-100%100%
get_KeyUsage()-100%100%
get_ValidityInMonths()-100%100%
Validate()-66.67%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Microsoft.Azure.KeyVault\src\Generated\Models\X509CertificateProperties.cs

#LineLine coverage
 1// <auto-generated>
 2// Copyright (c) Microsoft Corporation. All rights reserved.
 3// Licensed under the MIT License. See License.txt in the project root for
 4// license information.
 5//
 6// Code generated by Microsoft (R) AutoRest Code Generator.
 7// Changes may cause incorrect behavior and will be lost if the code is
 8// regenerated.
 9// </auto-generated>
 10
 11namespace Microsoft.Azure.KeyVault.Models
 12{
 13    using Microsoft.Rest;
 14    using Newtonsoft.Json;
 15    using System.Collections;
 16    using System.Collections.Generic;
 17    using System.Linq;
 18
 19    /// <summary>
 20    /// Properties of the X509 component of a certificate.
 21    /// </summary>
 22    public partial class X509CertificateProperties
 23    {
 24        /// <summary>
 25        /// Initializes a new instance of the X509CertificateProperties class.
 26        /// </summary>
 10427        public X509CertificateProperties()
 28        {
 29            CustomInit();
 10430        }
 31
 32        /// <summary>
 33        /// Initializes a new instance of the X509CertificateProperties class.
 34        /// </summary>
 35        /// <param name="subject">The subject name. Should be a valid X509
 36        /// distinguished Name.</param>
 37        /// <param name="ekus">The enhanced key usage.</param>
 38        /// <param name="subjectAlternativeNames">The subject alternative
 39        /// names.</param>
 40        /// <param name="keyUsage">List of key usages.</param>
 41        /// <param name="validityInMonths">The duration that the ceritifcate is
 42        /// valid in months.</param>
 043        public X509CertificateProperties(string subject = default(string), IList<string> ekus = default(IList<string>), 
 44        {
 045            Subject = subject;
 046            Ekus = ekus;
 047            SubjectAlternativeNames = subjectAlternativeNames;
 048            KeyUsage = keyUsage;
 049            ValidityInMonths = validityInMonths;
 50            CustomInit();
 051        }
 52
 53        /// <summary>
 54        /// An initialization method that performs custom operations like setting defaults
 55        /// </summary>
 56        partial void CustomInit();
 57
 58        /// <summary>
 59        /// Gets or sets the subject name. Should be a valid X509 distinguished
 60        /// Name.
 61        /// </summary>
 62        [JsonProperty(PropertyName = "subject")]
 11463        public string Subject { get; set; }
 64
 65        /// <summary>
 66        /// Gets or sets the enhanced key usage.
 67        /// </summary>
 68        [JsonProperty(PropertyName = "ekus")]
 20269        public IList<string> Ekus { get; set; }
 70
 71        /// <summary>
 72        /// Gets or sets the subject alternative names.
 73        /// </summary>
 74        [JsonProperty(PropertyName = "sans")]
 5875        public SubjectAlternativeNames SubjectAlternativeNames { get; set; }
 76
 77        /// <summary>
 78        /// Gets or sets list of key usages.
 79        /// </summary>
 80        [JsonProperty(PropertyName = "key_usage")]
 20281        public IList<string> KeyUsage { get; set; }
 82
 83        /// <summary>
 84        /// Gets or sets the duration that the ceritifcate is valid in months.
 85        /// </summary>
 86        [JsonProperty(PropertyName = "validity_months")]
 12087        public int? ValidityInMonths { get; set; }
 88
 89        /// <summary>
 90        /// Validate the object.
 91        /// </summary>
 92        /// <exception cref="ValidationException">
 93        /// Thrown if validation fails
 94        /// </exception>
 95        public virtual void Validate()
 96        {
 897            if (ValidityInMonths < 0)
 98            {
 099                throw new ValidationException(ValidationRules.InclusiveMinimum, "ValidityInMonths", 0);
 100            }
 8101        }
 102    }
 103}