< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Configuration.ServiceConfigurationDelegateHolder
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Configuration/ServiceConfigurationDelegateHolder.cs
Line coverage
100%
Covered lines: 13
Uncovered lines: 0
Coverable lines: 13
Total lines: 51
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%
AddConfigDelegate(...)100%11100%
Configure(...)100%22100%
AddServiceOptionsDelegate(...)100%11100%
ApplyOptions(...)100%44100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Configuration/ServiceConfigurationDelegateHolder.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 System;
 5using System.Collections.Generic;
 6
 7namespace CoreWCF.Configuration
 8{
 9    internal class ServiceConfigurationDelegateHolder
 10    {
 114011        private readonly List<Action<ServiceHostBase>> _configDelegates = new List<Action<ServiceHostBase>>();
 114012        private readonly List<Action<ServiceOptions>> _serviceOptionsDelegates = new List<Action<ServiceOptions>>();
 13        internal void AddConfigDelegate(Action<ServiceHostBase> func)
 14        {
 5915            _configDelegates.Add(func);
 5916        }
 17
 18        internal void Configure(ServiceHostBase host)
 19        {
 242820            foreach (Action<ServiceHostBase> del in _configDelegates)
 21            {
 6222                del(host);
 23            }
 115224        }
 25
 26        internal void AddServiceOptionsDelegate(Action<ServiceOptions> options)
 27        {
 3528            _serviceOptionsDelegates.Add(options);
 3529        }
 30
 31        internal bool ApplyOptions(ServiceOptions options)
 32        {
 111733            if (_serviceOptionsDelegates.Count == 0) return false;
 14034            foreach(Action<ServiceOptions> del in _serviceOptionsDelegates)
 35            {
 3536                del(options);
 37            }
 38
 3539            return true;
 40        }
 41    }
 42
 43    // Used by ConfigureAllServiceHostBase
 44    internal class AllServicesConfigurationDelegateHolder : ServiceConfigurationDelegateHolder { }
 45
 46    internal class ServiceConfigurationDelegateHolder<TService> : ServiceConfigurationDelegateHolder
 47        where TService : class
 48    {
 49
 50    }
 51}