< Summary

Class:Azure.ResourceManager.Network.NetworkInterfaceLoadBalancersOperations
Assembly:Azure.ResourceManager.Network
File(s):C:\Git\azure-sdk-for-net\sdk\network\Azure.ResourceManager.Network\src\Generated\NetworkInterfaceLoadBalancersOperations.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\NetworkInterfaceLoadBalancersOperations.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 NetworkInterfaceLoadBalancers service client. </summary>
 19    public partial class NetworkInterfaceLoadBalancersOperations
 20    {
 21        private readonly ClientDiagnostics _clientDiagnostics;
 22        private readonly HttpPipeline _pipeline;
 423        internal NetworkInterfaceLoadBalancersRestOperations RestClient { get; }
 24        /// <summary> Initializes a new instance of NetworkInterfaceLoadBalancersOperations for mocking. </summary>
 425        protected NetworkInterfaceLoadBalancersOperations()
 26        {
 427        }
 28        /// <summary> Initializes a new instance of NetworkInterfaceLoadBalancersOperations. </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>
 433        internal NetworkInterfaceLoadBalancersOperations(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, str
 34        {
 435            RestClient = new NetworkInterfaceLoadBalancersRestOperations(clientDiagnostics, pipeline, subscriptionId, en
 436            _clientDiagnostics = clientDiagnostics;
 437            _pipeline = pipeline;
 438        }
 39
 40        /// <summary> List all load balancers in a network interface. </summary>
 41        /// <param name="resourceGroupName"> The name of the resource group. </param>
 42        /// <param name="networkInterfaceName"> The name of the network interface. </param>
 43        /// <param name="cancellationToken"> The cancellation token to use. </param>
 44        public virtual AsyncPageable<LoadBalancer> ListAsync(string resourceGroupName, string networkInterfaceName, Canc
 45        {
 246            if (resourceGroupName == null)
 47            {
 048                throw new ArgumentNullException(nameof(resourceGroupName));
 49            }
 250            if (networkInterfaceName == null)
 51            {
 052                throw new ArgumentNullException(nameof(networkInterfaceName));
 53            }
 54
 55            async Task<Page<LoadBalancer>> FirstPageFunc(int? pageSizeHint)
 56            {
 257                using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersOperations.List");
 258                scope.Start();
 59                try
 60                {
 261                    var response = await RestClient.ListAsync(resourceGroupName, networkInterfaceName, cancellationToken
 262                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 63                }
 064                catch (Exception e)
 65                {
 066                    scope.Failed(e);
 067                    throw;
 68                }
 269            }
 70            async Task<Page<LoadBalancer>> NextPageFunc(string nextLink, int? pageSizeHint)
 71            {
 072                using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersOperations.List");
 073                scope.Start();
 74                try
 75                {
 076                    var response = await RestClient.ListNextPageAsync(nextLink, resourceGroupName, networkInterfaceName,
 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            }
 285            return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc);
 86        }
 87
 88        /// <summary> List all load balancers in a network interface. </summary>
 89        /// <param name="resourceGroupName"> The name of the resource group. </param>
 90        /// <param name="networkInterfaceName"> The name of the network interface. </param>
 91        /// <param name="cancellationToken"> The cancellation token to use. </param>
 92        public virtual Pageable<LoadBalancer> List(string resourceGroupName, string networkInterfaceName, CancellationTo
 93        {
 294            if (resourceGroupName == null)
 95            {
 096                throw new ArgumentNullException(nameof(resourceGroupName));
 97            }
 298            if (networkInterfaceName == null)
 99            {
 0100                throw new ArgumentNullException(nameof(networkInterfaceName));
 101            }
 102
 103            Page<LoadBalancer> FirstPageFunc(int? pageSizeHint)
 104            {
 2105                using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersOperations.List");
 2106                scope.Start();
 107                try
 108                {
 2109                    var response = RestClient.List(resourceGroupName, networkInterfaceName, cancellationToken);
 2110                    return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse());
 111                }
 0112                catch (Exception e)
 113                {
 0114                    scope.Failed(e);
 0115                    throw;
 116                }
 2117            }
 118            Page<LoadBalancer> NextPageFunc(string nextLink, int? pageSizeHint)
 119            {
 0120                using var scope = _clientDiagnostics.CreateScope("NetworkInterfaceLoadBalancersOperations.List");
 0121                scope.Start();
 122                try
 123                {
 0124                    var response = RestClient.ListNextPage(nextLink, resourceGroupName, networkInterfaceName, cancellati
 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            }
 2133            return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc);
 134        }
 135    }
 136}