< Summary

Class:Azure.Messaging.EventHubs.Core.TransportTypeExtensions
Assembly:Azure.Messaging.EventHubs
File(s):C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.Messaging.EventHubs\src\Core\TransportTypeExtensions.cs
Covered lines:3
Uncovered lines:0
Coverable lines:3
Total lines:49
Line coverage:100% (3 of 3)
Covered branches:2
Total branches:2
Branch coverage:100% (2 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
GetUriScheme(...)-100%100%
IsWebSocketTransport(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\eventhub\Azure.Messaging.EventHubs\src\Core\TransportTypeExtensions.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using System.Globalization;
 6
 7namespace Azure.Messaging.EventHubs.Core
 8{
 9    /// <summary>
 10    ///   The set of extension methods for the <see cref="EventHubsTransportType" /> enumeration.
 11    /// </summary>
 12    ///
 13    internal static class TransportTypeExtensions
 14    {
 15        /// <summary>The URI scheme used for an AMQP-based connection.</summary>
 16        private const string AmqpUriScheme = "amqps";
 17
 18        /// <summary>
 19        ///   Determines the URI scheme to be used for the given connection type.
 20        /// </summary>
 21        ///
 22        /// <param name="instance">The instance that this method was invoked on.</param>
 23        ///
 24        /// <returns>The scheme that should be used for the given connection type when forming an associated URI.</retur
 25        ///
 26        public static string GetUriScheme(this EventHubsTransportType instance)
 27        {
 28            switch (instance)
 29            {
 30                case EventHubsTransportType.AmqpTcp:
 31                case EventHubsTransportType.AmqpWebSockets:
 79032                    return AmqpUriScheme;
 33
 34                default:
 235                    throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.InvalidTransportType
 36            }
 37        }
 38
 39        /// <summary>
 40        ///   Determines whether the specified transport makes use of web sockets.
 41        /// </summary>
 42        ///
 43        /// <param name="instance">The instance that this method was invoked on.</param>
 44        ///
 45        /// <returns><c>true</c> if the transport uses web sockets; otherwise, <c>false</c>.</returns>
 46        ///
 47847        public static bool IsWebSocketTransport(this EventHubsTransportType instance) => (instance == EventHubsTransport
 48    }
 49}