< Summary

Class:Microsoft.Extensions.Azure.DefaultClientOptionsSetup`1
Assembly:Microsoft.Extensions.Azure
File(s):C:\Git\azure-sdk-for-net\sdk\core\Microsoft.Extensions.Azure\src\Internal\DefaultClientOptionsSetup.cs
Covered lines:10
Uncovered lines:0
Coverable lines:10
Total lines:38
Line coverage:100% (10 of 10)
Covered branches:4
Total branches:4
Branch coverage:100% (4 of 4)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor(...)-100%100%
Configure(...)-100%100%
Configure(...)-100%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\core\Microsoft.Extensions.Azure\src\Internal\DefaultClientOptionsSetup.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Azure.Core;
 6using Azure.Core.Pipeline;
 7using Microsoft.Extensions.Options;
 8
 9namespace Microsoft.Extensions.Azure
 10{
 11    internal class DefaultClientOptionsSetup<T> : IConfigureNamedOptions<T> where T : class
 12    {
 13        private readonly IOptions<AzureClientsGlobalOptions> _defaultOptions;
 14        private readonly IServiceProvider _serviceProvider;
 15
 4216        public DefaultClientOptionsSetup(IOptions<AzureClientsGlobalOptions> defaultOptions, IServiceProvider servicePro
 17        {
 4218            _defaultOptions = defaultOptions;
 4219            _serviceProvider = serviceProvider;
 4220        }
 21
 22        public void Configure(T options)
 23        {
 4224            if (options is ClientOptions clientOptions)
 25            {
 9626                foreach (var globalConfigureOption in _defaultOptions.Value.ConfigureOptionDelegates)
 27                {
 628                    globalConfigureOption(clientOptions, _serviceProvider);
 29                }
 30            }
 4231        }
 32
 33        public void Configure(string name, T options)
 34        {
 4235            Configure(options);
 4236        }
 37    }
 38}