< Summary

Class:Azure.Security.KeyVault.Keys.Cryptography.CryptographyClientOptions
Assembly:Azure.Security.KeyVault.Keys
File(s):C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\Cryptography\CryptographyClientOptions.cs
Covered lines:10
Uncovered lines:2
Coverable lines:12
Total lines:75
Line coverage:83.3% (10 of 12)
Covered branches:2
Total branches:4
Branch coverage:50% (2 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_Version()-100%100%
.ctor(...)-100%100%
GetVersionString()-71.43%50%

File(s)

C:\Git\azure-sdk-for-net\sdk\keyvault\Azure.Security.KeyVault.Keys\src\Cryptography\CryptographyClientOptions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Azure.Core;
 6
 7namespace Azure.Security.KeyVault.Keys.Cryptography
 8{
 9    /// <summary>
 10    /// Options that allow you to configure the management of the request sent to Key Vault.
 11    /// </summary>
 12    public class CryptographyClientOptions : ClientOptions
 13    {
 14        /// <summary>
 15        /// The latest service version supported by this client library.
 16        /// For more information, see
 17        /// <see href="https://docs.microsoft.com/rest/api/keyvault/key-vault-versions">Key Vault versions</see>.
 18        /// </summary>
 19        internal const ServiceVersion LatestVersion = ServiceVersion.V7_1_Preview;
 20
 21        /// <summary>
 22        /// The versions of Azure Key Vault supported by this client
 23        /// library.
 24        /// </summary>
 25        public enum ServiceVersion
 26        {
 27#pragma warning disable CA1707 // Identifiers should not contain underscores
 28            /// <summary>
 29            /// The Key Vault API version 7.0.
 30            /// </summary>
 31            V7_0 = 0,
 32
 33            /// <summary>
 34            /// The Key Vault API version 7.1-preview.
 35            /// </summary>
 36            V7_1_Preview = 1,
 37#pragma warning restore CA1707 // Identifiers should not contain underscores
 38        }
 39
 40        /// <summary>
 41        /// Gets the <see cref="ServiceVersion"/> of the service API used when
 42        /// making requests. For more information, see
 43        /// <see href="https://docs.microsoft.com/rest/api/keyvault/key-vault-versions">Key Vault versions</see>.
 44        /// </summary>
 31645        public ServiceVersion Version { get; }
 46
 47        /// <summary>
 48        /// Initializes a new instance of the <see cref="CryptographyClientOptions"/> class.
 49        /// class.
 50        /// </summary>
 51        /// <param name="version">
 52        /// The <see cref="ServiceVersion"/> of the service API used when
 53        /// making requests.
 54        /// </param>
 55#pragma warning disable AZC0010 // ClientOptions constructors should default ServiceVersion to latest supported service 
 31656        public CryptographyClientOptions(ServiceVersion version = LatestVersion)
 57#pragma warning restore AZC0010 // ClientOptions constructors should default ServiceVersion to latest supported service 
 58        {
 31659            Version = version;
 60
 31661            this.ConfigureLogging();
 31662        }
 63
 64        internal string GetVersionString()
 65        {
 31666            return Version switch
 31667            {
 068                ServiceVersion.V7_0 => "7.0",
 63269                ServiceVersion.V7_1_Preview => "7.1-preview",
 31670
 071                _ => throw new NotSupportedException($"The service version {Version} is not supported."),
 31672            };
 73        }
 74    }
 75}