< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Configuration.ConfigurationManagerExtensions
Assembly: CoreWCF.ConfigurationManager
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/ConfigurationManagerExtensions.cs
Line coverage
100%
Covered lines: 8
Uncovered lines: 0
Coverable lines: 8
Total lines: 29
Line coverage: 100%
Branch coverage
50%
Covered branches: 2
Total branches: 4
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
AddServiceModelConfigurationManagerFile(...)50%44100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/ConfigurationManagerExtensions.cs

#LineLine coverage
 1// Licensed to the .NET Foundation under one or more agreements.
 2// The .NET Foundation licenses this file to you under the MIT license.
 3
 4using Microsoft.Extensions.DependencyInjection;
 5using Microsoft.Extensions.DependencyInjection.Extensions;
 6using Microsoft.Extensions.Options;
 7using System.IO;
 8using System;
 9
 10namespace CoreWCF.Configuration
 11{
 12    public static class ConfigurationManagerExtensions
 13    {
 14        public static IServiceCollection AddServiceModelConfigurationManagerFile(this IServiceCollection builder, string
 15        {
 4016            if (!File.Exists(path)) { throw new FileNotFoundException(SR.Format(SR.FileNotFound, path)); }
 4017            using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read))
 18            {
 4019                if (!fs.CanRead) { throw new IOException(SR.Format(SR.CannotAccessFile, path)); }
 4020            }
 21
 4022            builder.TryAddSingleton<IConfigurationHolder, ConfigurationHolder>();
 4023            builder.TryAddSingleton<IBindingFactory, BindingFactory>();
 8024            builder.AddSingleton<IConfigureOptions<ServiceModelOptions>>(ctx => new ConfigurationManagerServiceModelOpti
 25
 4026            return builder;
 27        }
 28    }
 29}