< Summary

Class:Azure.Iot.Hub.Service.StatisticsClient
Assembly:Azure.Iot.Hub.Service
File(s):C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\StatisticsClient.cs
Covered lines:10
Uncovered lines:0
Coverable lines:10
Total lines:76
Line coverage:100% (10 of 10)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-100%100%
.ctor(...)-100%100%
GetDevicesStatistics(...)-100%100%
GetDevicesStatisticsAsync(...)-100%100%
GetServiceStatistics(...)-100%100%
GetServiceStatisticsAsync(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\iot\Azure.Iot.Hub.Service\src\StatisticsClient.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Threading;
 5using System.Threading.Tasks;
 6using Azure.Core;
 7using Azure.Iot.Hub.Service.Models;
 8
 9namespace Azure.Iot.Hub.Service
 10{
 11    /// <summary>
 12    /// Statistics client to acquire information about IoT Hub statistics.
 13    /// </summary>
 14    public class StatisticsClient
 15    {
 16        private readonly StatisticsRestClient _statisticsRestClient = null;
 17
 18        /// <summary>
 19        /// Initializes a new instance of StatisticsClient.
 20        /// </summary>
 821        protected StatisticsClient()
 22        {
 823        }
 24
 25        /// <summary>
 26        /// Initializes a new instance of StatisticsClient.
 27        /// <param name="statisticsRestClient"> The REST client to query statistics of the IoT Hub. </param>
 28        /// </summary>
 7629        internal StatisticsClient(StatisticsRestClient statisticsRestClient)
 30        {
 7631            Argument.AssertNotNull(statisticsRestClient, nameof(statisticsRestClient));
 32
 7633            _statisticsRestClient = statisticsRestClient;
 7634        }
 35
 36        /// <summary>
 37        /// Gets devices statistics of the IoT Hub identity registry.
 38        /// </summary>
 39        /// <param name="cancellationToken">The cancellation token.</param>
 40        /// <returns>The devices statistics of the IoT Hub.</returns>
 41        public virtual Response<DevicesStatistics> GetDevicesStatistics(CancellationToken cancellationToken = default)
 42        {
 243            return _statisticsRestClient.GetDeviceStatistics(cancellationToken);
 44        }
 45
 46        /// <summary>
 47        /// Gets devices statistics of the IoT Hub identity registry.
 48        /// </summary>
 49        /// <param name="cancellationToken">The cancellation token.</param>
 50        /// <returns>The devices statistics of the IoT Hub.</returns>
 51        public virtual Task<Response<DevicesStatistics>> GetDevicesStatisticsAsync(CancellationToken cancellationToken =
 52        {
 253            return _statisticsRestClient.GetDeviceStatisticsAsync(cancellationToken);
 54        }
 55
 56        /// <summary>
 57        /// Gets service statistics of the IoT Hub.
 58        /// </summary>
 59        /// <param name="cancellationToken">The cancellation token.</param>
 60        /// <returns>The service statistics of the IoT Hub.</returns>
 61        public virtual Response<ServiceStatistics> GetServiceStatistics(CancellationToken cancellationToken = default)
 62        {
 263            return _statisticsRestClient.GetServiceStatistics(cancellationToken);
 64        }
 65
 66        /// <summary>
 67        /// Gets service statistics of the IoT Hub.
 68        /// </summary>
 69        /// <param name="cancellationToken">The cancellation token.</param>
 70        /// <returns>The service statistics of the IoT Hub.</returns>
 71        public virtual Task<Response<ServiceStatistics>> GetServiceStatisticsAsync(CancellationToken cancellationToken =
 72        {
 273            return _statisticsRestClient.GetServiceStatisticsAsync(cancellationToken);
 74        }
 75    }
 76}