< Summary

Class:Azure.Security.KeyVault.Certificates.CertificateContentType
Assembly:Azure.Security.KeyVault.Certificates
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Certificates\src\CertificateContentType.cs
Covered lines:8
Uncovered lines:3
Coverable lines:11
Total lines:71
Line coverage:72.7% (8 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_Pkcs12()-100%100%
get_Pem()-100%100%
op_Equality(...)-100%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\CertificateContentType.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    /// Content type of the certificate when downloaded from getSecret.
 11    /// </summary>
 12    public readonly struct CertificateContentType : IEquatable<CertificateContentType>
 13    {
 14        private readonly string _value;
 15
 16        /// <summary>
 17        /// Initializes a new instance of the <see cref="CertificateContentType"/> structure.
 18        /// </summary>
 19        /// <param name="value">The string value of the instance.</param>
 20        public CertificateContentType(string value)
 21        {
 7422            _value = value ?? throw new ArgumentNullException(nameof(value));
 7423        }
 24
 25        /// <summary>
 26        /// Gets a value indicating that content is downloaded in pkcs12 (PFX) format.
 27        /// </summary>
 7628        public static CertificateContentType Pkcs12 { get; } = new CertificateContentType("application/x-pkcs12");
 29
 30        /// <summary>
 31        /// Gets a value indicating that content is downloaded in PEM format.
 32        /// </summary>
 1833        public static CertificateContentType Pem { get; } = new CertificateContentType("application/x-pem-file");
 34
 35        /// <summary>
 36        /// Determines if two <see cref="CertificateContentType"/> values are the same.
 37        /// </summary>
 38        /// <param name="left">The first <see cref="CertificateContentType"/> to compare.</param>
 39        /// <param name="right">The second <see cref="CertificateContentType"/> to compare.</param>
 40        /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are the same; otherwise, false.</retur
 841        public static bool operator ==(CertificateContentType left, CertificateContentType right) => left.Equals(right);
 42
 43        /// <summary>
 44        /// Determines if two <see cref="CertificateContentType"/> values are different.
 45        /// </summary>
 46        /// <param name="left">The first <see cref="CertificateContentType"/> to compare.</param>
 47        /// <param name="right">The second <see cref="CertificateContentType"/> to compare.</param>
 48        /// <returns>True if <paramref name="left"/> and <paramref name="right"/> are different; otherwise, false.</retu
 049        public static bool operator !=(CertificateContentType left, CertificateContentType right) => !left.Equals(right)
 50
 51        /// <summary>
 52        /// Converts a string to a <see cref="CertificateContentType"/>.
 53        /// </summary>
 54        /// <param name="value">The string value to convert.</param>
 7055        public static implicit operator CertificateContentType(string value) => new CertificateContentType(value);
 56
 57        /// <inheritdoc/>
 58        [EditorBrowsable(EditorBrowsableState.Never)]
 059        public override bool Equals(object obj) => obj is CertificateContentType other && Equals(other);
 60
 61        /// <inheritdoc/>
 1462        public bool Equals(CertificateContentType other) => string.Equals(_value, other._value, StringComparison.Ordinal
 63
 64        /// <inheritdoc/>
 65        [EditorBrowsable(EditorBrowsableState.Never)]
 066        public override int GetHashCode() => _value?.GetHashCode() ?? 0;
 67
 68        /// <inheritdoc/>
 7069        public override string ToString() => _value;
 70    }
 71}