< Summary

Class:ApplicationCore.ConfigProvider
Assembly:ApplicationCore
File(s):C:\Users\Teknikaali\Source\Repos\jekyll-blog-comments\ApplicationCore\Configuration\ConfigProvider.cs
Covered lines:8
Uncovered lines:0
Coverable lines:8
Total lines:26
Line coverage:100% (8 of 8)
Covered branches:4
Total branches:4
Branch coverage:100% (4 of 4)

Coverage History

Metrics

MethodCyclomatic complexity NPath complexity Sequence coverage Branch coverage
GetConfig(...)40100%100%

File(s)

C:\Users\Teknikaali\Source\Repos\jekyll-blog-comments\ApplicationCore\Configuration\ConfigProvider.cs

#LineLine coverage
 1using System;
 2using Microsoft.Extensions.Configuration;
 3
 4namespace ApplicationCore
 5{
 6    public interface IConfigProvider
 7    {
 8        T GetConfig<T>(IConfigurationRoot config) where T : new();
 9    }
 10
 11    public class ConfigProvider : IConfigProvider
 12    {
 13        public T GetConfig<T>(IConfigurationRoot configRoot) where T : new()
 1214        {
 1215            if (configRoot is null)
 116            {
 117                throw new ArgumentNullException(nameof(configRoot));
 18            }
 19
 1120            var config = new T();
 2221            configRoot.GetSection(typeof(T).Name).Bind(config, x => x.BindNonPublicProperties = true);
 22
 1123            return config;
 1124        }
 25    }
 26}