< Summary

Class:Azure.Security.KeyVault.Certificates.CertificatePolicyAction
Assembly:Azure.Security.KeyVault.Certificates
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\CertificatePolicyAction.cs
Covered lines:6
Uncovered lines:5
Coverable lines:11
Total lines:74
Line coverage:54.5% (6 of 11)
Covered branches:1
Total branches:6
Branch coverage:16.6% (1 of 6)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%50%
get_AutoRenew()-0%100%
get_EmailContacts()-100%100%
op_Equality(...)-0%100%
op_Inequality(...)-0%100%
op_Implicit(...)-100%100%
Equals(...)-0%0%
Equals(...)-100%100%
GetHashCode()-0%0%
ToString()-100%100%

File(s)

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

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.ComponentModel;
 6
 7namespace Azure.Security.KeyVault.Certificates
 8{
 9    /// <summary>
 10    /// An action that will be executed.
 11    /// </summary>
 12    public readonly struct CertificatePolicyAction : IEquatable<CertificatePolicyAction>
 13    {
 14        internal const string AutoRenewValue = "AutoRenew";
 15        internal const string EmailContactsValue = "EmailContacts";
 16
 17        private readonly string _value;
 18
 19        /// <summary>
 20        /// Initializes a new instance of the <see cref="CertificatePolicyAction"/> structure.
 21        /// </summary>
 22        /// <param name="value">The string value of the instance.</param>
 23        public CertificatePolicyAction(string value)
 24        {
 7425            _value = value ?? throw new ArgumentNullException(nameof(value));
 7426        }
 27
 28        /// <summary>
 29        /// Gets a <see cref="CertificatePolicyAction"/> that will auto-renew a certificate.
 30        /// </summary>
 031        public static CertificatePolicyAction AutoRenew { get; } = new CertificatePolicyAction(AutoRenewValue);
 32
 33        /// <summary>
 34        /// Gets a <see cref="CertificatePolicyAction"/> action that will email certificate contacts.
 35        /// </summary>
 436        public static CertificatePolicyAction EmailContacts { get; } = new CertificatePolicyAction(EmailContactsValue);
 37
 38        /// <summary>
 39        /// Determines if two <see cref="CertificatePolicyAction"/> values are the same.
 40        /// </summary>
 41        /// <param name="left">The first <see cref="CertificatePolicyAction"/> to compare.</param>
 42        /// <param name="right">The second <see cref="CertificatePolicyAction"/> to compare.</param>
 43        /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are the same; otherwise, false.</retur
 044        public static bool operator ==(CertificatePolicyAction left, CertificatePolicyAction right) => left.Equals(right
 45
 46        /// <summary>
 47        /// Determines if two <see cref="CertificatePolicyAction"/> values are different.
 48        /// </summary>
 49        /// <param name="left">The first <see cref="CertificatePolicyAction"/> to compare.</param>
 50        /// <param name="right">The second <see cref="CertificatePolicyAction"/> to compare.</param>
 51        /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are different; otherwise, false.</retu
 052        public static bool operator !=(CertificatePolicyAction left, CertificatePolicyAction right) => !left.Equals(righ
 53
 54        /// <summary>
 55        /// Converts a string to a <see cref="CertificatePolicyAction"/>.
 56        /// </summary>
 57        /// <param name="value">The string value to convert.</param>
 7058        public static implicit operator CertificatePolicyAction(string value) => new CertificatePolicyAction(value);
 59
 60        /// <inheritdoc/>
 61        [EditorBrowsable(EditorBrowsableState.Never)]
 062        public override bool Equals(object obj) => obj is CertificatePolicyAction other && Equals(other);
 63
 64        /// <inheritdoc/>
 265        public bool Equals(CertificatePolicyAction other) => string.Equals(_value, other._value, StringComparison.Ordina
 66
 67        /// <inheritdoc/>
 68        [EditorBrowsable(EditorBrowsableState.Never)]
 069        public override int GetHashCode() => _value?.GetHashCode() ?? 0;
 70
 71        /// <inheritdoc/>
 272        public override string ToString() => _value;
 73    }
 74}