< Summary

Class:Azure.ResourceManager.Network.LoadBalancerNetworkInterfacesOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\LoadBalancerNetworkInterfacesOperations.cs
Covered lines:24
Uncovered lines:26
Coverable lines:50
Total lines:136
Line coverage:48% (24 of 50)
Covered branches:4
Total branches:8
Branch coverage:50% (4 of 8)

Metrics

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

File(s)

C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\LoadBalancerNetworkInterfacesOperations.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.Network.Models;
 15
 16namespace Azure.ResourceManager.Network
 17{
 18    /// <summary> The LoadBalancerNetworkInterfaces service client. </summary>
 19    public partial class LoadBalancerNetworkInterfacesOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 823        internal LoadBalancerNetworkInterfacesRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of LoadBalancerNetworkInterfacesOperations for mocking. </summary>
 825        protected LoadBalancerNetworkInterfacesOperations()
 26        {
 827        }
 28        /// <summary> Initializes a new instance of LoadBalancerNetworkInterfacesOperations. </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 subscription credentials which uniquely identify the Microsoft Azure subsc
 32        /// <param name="endpoint"> server parameter. </param>
 833        internal LoadBalancerNetworkInterfacesOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, str
 34        {
 835            RestClient = new LoadBalancerNetworkInterfacesRestOperations(clientDiagnostics, pipeline, subscriptionId, en
 836            _clientDiagnostics = clientDiagnostics;
 837            _pipeline = pipeline;
 838        }
 39
 40        /// <summary> Gets associated load balancer network interfaces. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual AsyncPageable<NetworkInterface> ListAsync(string resourceGroupName, string loadBalancerName, Canc
 45        {
 446            if (resourceGroupName == null)
 47            {
 048                throw new ArgumentNullException(nameof(resourceGroupName));
 49            }
 450            if (loadBalancerName == null)
 51            {
 052                throw new ArgumentNullException(nameof(loadBalancerName));
 53            }
 54
 55            async Task<Page<NetworkInterface>> FirstPageFunc(int? pageSizeHint)
 56            {
 457                using var scope = _clientDiagnostics.CreateScope("LoadBalancerNetworkInterfacesOperations.List");
 458                scope.Start();
 59                try
 60                {
 461                    var response = await RestClient.ListAsync(resourceGroupName, loadBalancerName, cancellationToken).Co
 462                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 63                }
 064                catch (Exception e)
 65                {
 066                    scope.Failed(e);
 067                    throw;
 68                }
 469            }
 70            async Task<Page<NetworkInterface>> NextPageFunc(string nextLink, int? pageSizeHint)
 71            {
 072                using var scope = _clientDiagnostics.CreateScope("LoadBalancerNetworkInterfacesOperations.List");
 073                scope.Start();
 74                try
 75                {
 076                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, loadBalancerName, can
 077                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 78                }
 079                catch (Exception e)
 80                {
 081                    scope.Failed(e);
 082                    throw;
 83                }
 084            }
 485            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 86        }
 87
 88        /// <summary> Gets associated load balancer network interfaces. </summary>
 89        /// <param name="resourceGroupName"> The name of the resource group. </param>
 90        /// <param name="loadBalancerName"> The name of the load balancer. </param>
 91        /// <param name="cancellationToken"> The cancellation token to use. </param>
 92        public virtual Pageable<NetworkInterface> List(string resourceGroupName, string loadBalancerName, CancellationTo
 93        {
 494            if (resourceGroupName == null)
 95            {
 096                throw new ArgumentNullException(nameof(resourceGroupName));
 97            }
 498            if (loadBalancerName == null)
 99            {
 0100                throw new ArgumentNullException(nameof(loadBalancerName));
 101            }
 102
 103            Page<NetworkInterface> FirstPageFunc(int? pageSizeHint)
 104            {
 4105                using var scope = _clientDiagnostics.CreateScope("LoadBalancerNetworkInterfacesOperations.List");
 4106                scope.Start();
 107                try
 108                {
 4109                    var response = RestClient.List(resourceGroupName, loadBalancerName, cancellationToken);
 4110                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 111                }
 0112                catch (Exception e)
 113                {
 0114                    scope.Failed(e);
 0115                    throw;
 116                }
 4117            }
 118            Page<NetworkInterface> NextPageFunc(string nextLink, int? pageSizeHint)
 119            {
 0120                using var scope = _clientDiagnostics.CreateScope("LoadBalancerNetworkInterfacesOperations.List");
 0121                scope.Start();
 122                try
 123                {
 0124                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, loadBalancerName, cancellationTo
 0125                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 126                }
 0127                catch (Exception e)
 128                {
 0129                    scope.Failed(e);
 0130                    throw;
 131                }
 0132            }
 4133            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 134        }
 135    }
 136}