< Summary

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

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\DefaultCredentialClientOptionsSetup.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using Microsoft.Extensions.Options;
 5
 6namespace Microsoft.Extensions.Azure
 7{
 8    internal class DefaultCredentialClientOptionsSetup<T> : IConfigureNamedOptions<AzureClientCredentialOptions<T>>
 9    {
 10        private readonly IOptions<AzureClientsGlobalOptions> _defaultOptions;
 11
 4612        public DefaultCredentialClientOptionsSetup(IOptions<AzureClientsGlobalOptions> defaultOptions)
 13        {
 4614            _defaultOptions = defaultOptions;
 4615        }
 16
 17        public void Configure(AzureClientCredentialOptions<T> options)
 18        {
 4619            if (options.CredentialFactory == null)
 20            {
 4621                options.CredentialFactory = _defaultOptions.Value.CredentialFactory;
 22            }
 4623        }
 24
 25        public void Configure(string name, AzureClientCredentialOptions<T> options)
 26        {
 4627            Configure(options);
 4628        }
 29    }
 30}