< Summary

Class:Azure.Iot.Hub.Service.IotHubServiceClientOptions
Assembly:Azure.Iot.Hub.Service
File(s):C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\IotHubServiceClientOptions.cs
Covered lines:8
Uncovered lines:1
Coverable lines:9
Total lines:54
Line coverage:88.8% (8 of 9)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\IotHubServiceClientOptions.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.Iot.Hub.Service
 8{
 9    /// <summary>
 10    /// Options that allow configuration of requests sent to the IoTHub service.
 11    /// </summary>
 12    public class IotHubServiceClientOptions : ClientOptions
 13    {
 14        internal const ServiceVersion LatestVersion = ServiceVersion.V2020_03_13;
 15
 16        /// <summary>
 17        /// The versions of IoTHub Service supported by this client
 18        /// library.
 19        /// </summary>
 20        [System.Diagnostics.CodeAnalysis.SuppressMessage("Naming", "CA1707:Identifiers should not contain underscores", 
 21        public enum ServiceVersion
 22        {
 23            /// <summary>
 24            /// 2020-03-13
 25            /// </summary>
 26            V2020_03_13 = 1
 27        }
 28
 29        /// <summary>
 30        /// Gets the <see cref="ServiceVersion"/> of the service API used when
 31        /// making requests.
 32        /// </summary>
 30433        public ServiceVersion Version { get; }
 34
 35        /// <summary>
 36        /// Initializes a new instance of the <see cref="IotHubServiceClientOptions"/>
 37        /// class.
 38        /// </summary>
 7639        public IotHubServiceClientOptions(ServiceVersion version = LatestVersion)
 40        {
 7641            Version = version;
 7642        }
 43
 44
 45        internal string GetVersionString()
 46        {
 30447            return Version switch
 30448            {
 60849                ServiceVersion.V2020_03_13 => "2020-03-13",
 050                _ => throw new ArgumentException(Version.ToString()),
 30451            };
 52        }
 53    }
 54}