< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.ConnectionPoolSettings
Assembly: CoreWCF.NetFramingBase
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.NetFramingBase/src/CoreWCF/Channels/ConnectionPoolSettings.cs
Line coverage
58%
Covered lines: 24
Uncovered lines: 17
Coverable lines: 41
Total lines: 106
Line coverage: 58.5%
Branch coverage
31%
Covered branches: 5
Total branches: 16
Branch coverage: 31.2%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%
.ctor(...)100%11100%
IsMatch(...)0%660%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.NetFramingBase/src/CoreWCF/Channels/ConnectionPoolSettings.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 CoreWCF.Runtime;
 6
 7namespace CoreWCF.Channels
 8{
 9    public class ConnectionPoolSettings
 10    {
 11        private TimeSpan _idleTimeout;
 12        private int _maxOutboundConnectionsPerEndpoint;
 13        private TimeSpan _channelInitializationTimeout;
 14
 20015        internal protected ConnectionPoolSettings()
 16        {
 20017            _channelInitializationTimeout = ConnectionOrientedTransportDefaults.ChannelInitializationTimeout;
 20018            _idleTimeout = ConnectionOrientedTransportDefaults.IdleTimeout;
 20019            _maxOutboundConnectionsPerEndpoint = ConnectionOrientedTransportDefaults.MaxOutboundConnectionsPerEndpoint;
 20020        }
 21
 192022        internal protected ConnectionPoolSettings(ConnectionPoolSettings other)
 23        {
 192024            _channelInitializationTimeout = other._channelInitializationTimeout;
 192025            _idleTimeout = other._idleTimeout;
 192026            _maxOutboundConnectionsPerEndpoint = other._maxOutboundConnectionsPerEndpoint;
 192027        }
 28
 29        public TimeSpan ChannelInitializationTimeout
 30        {
 7931            get => _channelInitializationTimeout;
 32            set
 33            {
 334                if (value <= TimeSpan.Zero)
 35                {
 036                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 037                        SRCommon.TimeSpanMustBeGreaterThanTimeSpanZero));
 38                }
 39
 340                if (TimeoutHelper.IsTooLarge(value))
 41                {
 042                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 043                        SRCommon.SFxTimeoutOutOfRangeTooBig));
 44                }
 45
 346                _channelInitializationTimeout = value;
 347            }
 48        }
 49
 50        public TimeSpan IdleTimeout
 51        {
 10652            get { return _idleTimeout; }
 53            set
 54            {
 255                if (value < TimeSpan.Zero)
 56                {
 057                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(Idl
 058                        SRCommon.SFxTimeoutOutOfRange0));
 59                }
 60
 261                if (TimeoutHelper.IsTooLarge(value))
 62                {
 063                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(Idl
 064                        SRCommon.SFxTimeoutOutOfRangeTooBig));
 65                }
 66
 267                _idleTimeout = value;
 268            }
 69        }
 70
 71        public int MaxOutboundConnectionsPerEndpoint
 72        {
 7273            get { return _maxOutboundConnectionsPerEndpoint; }
 74            set
 75            {
 276                if (value < 0)
 77                {
 078                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(Max
 079                        SRCommon.ValueMustBeNonNegative));
 80                }
 81
 282                _maxOutboundConnectionsPerEndpoint = value;
 283            }
 84        }
 85
 86        public bool IsMatch(ConnectionPoolSettings connectionPool)
 87        {
 088            if (_idleTimeout != connectionPool._idleTimeout)
 89            {
 090                return false;
 91            }
 92
 093            if (_maxOutboundConnectionsPerEndpoint != connectionPool._maxOutboundConnectionsPerEndpoint)
 94            {
 095                return false;
 96            }
 97
 098            if (_channelInitializationTimeout != connectionPool._channelInitializationTimeout)
 99            {
 0100                return false;
 101            }
 102
 0103            return true;
 104        }
 105    }
 106}