< Summary

Class:Azure.DigitalTwins.Core.DigitalTwinsClientOptions
Assembly:Azure.DigitalTwins.Core
File(s):C:\Git\azure-sdk-for-net\sdk\digitaltwins\Azure.DigitalTwins.Core\src\DigitalTwinsClientOptions.cs
Covered lines:8
Uncovered lines:1
Coverable lines:9
Total lines:60
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\digitaltwins\Azure.DigitalTwins.Core\src\DigitalTwinsClientOptions.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.DigitalTwins.Core
 8{
 9    /// <summary>
 10    /// Options that allow configuration of requests sent to the digital twins service.
 11    /// </summary>
 12    public class DigitalTwinsClientOptions : ClientOptions
 13    {
 14        internal const ServiceVersion LatestVersion = ServiceVersion.V2020_05_31_preview;
 15
 16        /// <summary>
 17        /// The versions of Azure Digital Twins supported by this client
 18        /// library.
 19        /// </summary>
 20        public enum ServiceVersion
 21        {
 22#pragma warning disable CA1707 // Identifiers should not contain underscores
 23
 24            /// <summary>
 25            /// 2020-05-31-preview
 26            /// </summary>
 27            V2020_05_31_preview = 1
 28
 29#pragma warning restore CA1707 // Identifiers should not contain underscores
 30        }
 31
 32        /// <summary>
 33        /// Gets the <see cref="ServiceVersion"/> of the service API used when
 34        /// making requests.
 35        /// </summary>
 18036        public ServiceVersion Version { get; }
 37
 38        /// <summary>
 39        /// Initializes a new instance of the <see cref="DigitalTwinsClientOptions"/>
 40        /// class.
 41        /// </summary>
 42        /// <param name="version">
 43        /// The <see cref="ServiceVersion"/> of the service API used when
 44        /// making requests.
 45        /// </param>
 6046        public DigitalTwinsClientOptions(ServiceVersion version = LatestVersion)
 47        {
 6048            Version = version;
 6049        }
 50
 51        internal string GetVersionString()
 52        {
 18053            return Version switch
 18054            {
 36055                ServiceVersion.V2020_05_31_preview => "2020-05-31-preview",
 056                _ => throw new ArgumentException(Version.ToString()),
 18057            };
 58        }
 59    }
 60}