< Summary

Class:Azure.ResourceManager.Storage.SkusOperations
Assembly:Azure.ResourceManager.Storage
File(s):C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\SkusOperations.cs
Covered lines:20
Uncovered lines:6
Coverable lines:26
Total lines:85
Line coverage:76.9% (20 of 26)
Covered branches:0
Total branches:0

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
get_RestClient()-100%100%
.ctor()-100%100%
.ctor(...)-100%100%
<ListAsync()-62.5%100%
ListAsync(...)-100%100%
List(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\storage\Azure.ResourceManager.Storage\src\Generated\SkusOperations.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4// <auto-generated/>
 5
 6#nullable disable
 7
 8using System;
 9using System.Threading;
 10using System.Threading.Tasks;
 11using Azure;
 12using Azure.Core;
 13using Azure.Core.Pipeline;
 14using Azure.ResourceManager.Storage.Models;
 15
 16namespace Azure.ResourceManager.Storage
 17{
 18    /// <summary> The Skus service client. </summary>
 19    public partial class SkusOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 423        internal SkusRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of SkusOperations for mocking. </summary>
 24025        protected SkusOperations()
 26        {
 24027        }
 28        /// <summary> Initializes a new instance of SkusOperations. </summary>
 29        /// <param name="clientDiagnostics"> The handler for diagnostic messaging in the client. </param>
 30        /// <param name="pipeline"> The HTTP pipeline for sending and receiving REST requests and responses. </param>
 31        /// <param name="subscriptionId"> The ID of the target subscription. </param>
 32        /// <param name="endpoint"> server parameter. </param>
 33        /// <param name="apiVersion"> Api Version. </param>
 24034        internal SkusOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string subscriptionId, Uri e
 35        {
 24036            RestClient = new SkusRestOperations(clientDiagnostics, pipeline, subscriptionId, endpoint, apiVersion);
 24037            _clientDiagnostics = clientDiagnostics;
 24038            _pipeline = pipeline;
 24039        }
 40
 41        /// <summary> Lists the available SKUs supported by Microsoft.Storage for given subscription. </summary>
 42        /// <param name="cancellationToken"> The cancellation token to use. </param>
 43        public virtual AsyncPageable<SkuInformation> ListAsync(CancellationToken cancellationToken = default)
 44        {
 45            async Task<Page<SkuInformation>> FirstPageFunc(int? pageSizeHint)
 46            {
 247                using var scope = _clientDiagnostics.CreateScope("SkusOperations.List");
 248                scope.Start();
 49                try
 50                {
 251                    var response = await RestClient.ListAsync(cancellationToken).ConfigureAwait(false);
 252                    return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
 53                }
 054                catch (Exception e)
 55                {
 056                    scope.Failed(e);
 057                    throw;
 58                }
 259            }
 260            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, null);
 61        }
 62
 63        /// <summary> Lists the available SKUs supported by Microsoft.Storage for given subscription. </summary>
 64        /// <param name="cancellationToken"> The cancellation token to use. </param>
 65        public virtual Pageable<SkuInformation> List(CancellationToken cancellationToken = default)
 66        {
 67            Page<SkuInformation> FirstPageFunc(int? pageSizeHint)
 68            {
 269                using var scope = _clientDiagnostics.CreateScope("SkusOperations.List");
 270                scope.Start();
 71                try
 72                {
 273                    var response = RestClient.List(cancellationToken);
 274                    return Page.FromValues(response.Value.Value, null, response.GetRawResponse());
 75                }
 076                catch (Exception e)
 77                {
 078                    scope.Failed(e);
 079                    throw;
 80                }
 281            }
 282            return PageableHelpers.CreateEnumerable(FirstPageFunc, null);
 83        }
 84    }
 85}