< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Configuration.ConnectionOrientedTransportElement
Assembly: CoreWCF.ConfigurationManager
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/ConnectionOrientedTransportElement.cs
Line coverage
42%
Covered lines: 25
Uncovered lines: 34
Coverable lines: 59
Total lines: 137
Line coverage: 42.3%
Branch coverage
60%
Covered branches: 6
Total branches: 10
Branch coverage: 60%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%
ApplyConfiguration(...)100%66100%
CopyFrom(...)100%110%
InitializeFrom(...)0%440%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/ConnectionOrientedTransportElement.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.Configuration;
 6using CoreWCF.Channels;
 7
 8namespace CoreWCF.Configuration
 9{
 10    public abstract class ConnectionOrientedTransportElement : TransportElement
 11    {
 212        internal ConnectionOrientedTransportElement()
 13        {
 214        }
 15
 16        [ConfigurationProperty(ConfigurationStrings.ConnectionBufferSize, DefaultValue = ConnectionOrientedTransportDefa
 17        [IntegerValidator(MinValue = 1)]
 18        public int ConnectionBufferSize
 19        {
 220            get { return (int)base[ConfigurationStrings.ConnectionBufferSize]; }
 021            set { base[ConfigurationStrings.ConnectionBufferSize] = value; }
 22        }
 23
 24        [ConfigurationProperty(ConfigurationStrings.HostNameComparisonMode, DefaultValue = ConnectionOrientedTransportDe
 25        public HostNameComparisonMode HostNameComparisonMode
 26        {
 227            get { return (HostNameComparisonMode)base[ConfigurationStrings.HostNameComparisonMode]; }
 028            set { base[ConfigurationStrings.HostNameComparisonMode] = value; }
 29        }
 30
 31        [ConfigurationProperty(ConfigurationStrings.ChannelInitializationTimeout, DefaultValue = ConnectionOrientedTrans
 32        public TimeSpan ChannelInitializationTimeout
 33        {
 234            get { return (TimeSpan)base[ConfigurationStrings.ChannelInitializationTimeout]; }
 035            set { base[ConfigurationStrings.ChannelInitializationTimeout] = value; }
 36        }
 37
 38        [ConfigurationProperty(ConfigurationStrings.MaxBufferSize, DefaultValue = TransportDefaults.MaxBufferSize)]
 39        [IntegerValidator(MinValue = 1)]
 40        public int MaxBufferSize
 41        {
 142            get { return (int)base[ConfigurationStrings.MaxBufferSize]; }
 043            set { base[ConfigurationStrings.MaxBufferSize] = value; }
 44        }
 45
 46        [ConfigurationProperty(ConfigurationStrings.MaxPendingConnections, DefaultValue = ConnectionOrientedTransportDef
 47        [IntegerValidator(MinValue = 0)]
 48        public int MaxPendingConnections
 49        {
 350            get { return (int)base[ConfigurationStrings.MaxPendingConnections]; }
 051            set { base[ConfigurationStrings.MaxPendingConnections] = value; }
 52        }
 53
 54        [ConfigurationProperty(ConfigurationStrings.MaxOutputDelay, DefaultValue = ConnectionOrientedTransportDefaults.M
 55        public TimeSpan MaxOutputDelay
 56        {
 257            get { return (TimeSpan)base[ConfigurationStrings.MaxOutputDelay]; }
 058            set { base[ConfigurationStrings.MaxOutputDelay] = value; }
 59        }
 60
 61        [ConfigurationProperty(ConfigurationStrings.MaxPendingAccepts, DefaultValue = ConnectionOrientedTransportDefault
 62        [IntegerValidator(MinValue = 0)]
 63        public int MaxPendingAccepts
 64        {
 365            get { return (int)base[ConfigurationStrings.MaxPendingAccepts]; }
 066            set { base[ConfigurationStrings.MaxPendingAccepts] = value; }
 67        }
 68
 69        [ConfigurationProperty(ConfigurationStrings.TransferMode, DefaultValue = ConnectionOrientedTransportDefaults.Tra
 70        public TransferMode TransferMode
 71        {
 272            get { return (TransferMode)base[ConfigurationStrings.TransferMode]; }
 073            set { base[ConfigurationStrings.TransferMode] = value; }
 74        }
 75
 76        public override void ApplyConfiguration(BindingElement bindingElement)
 77        {
 278            base.ApplyConfiguration(bindingElement);
 279            ConnectionOrientedTransportBindingElement binding = (ConnectionOrientedTransportBindingElement)bindingElemen
 280            binding.ConnectionBufferSize = ConnectionBufferSize;
 281            binding.HostNameComparisonMode = HostNameComparisonMode;
 282            binding.ChannelInitializationTimeout = ChannelInitializationTimeout;
 283            PropertyInformationCollection propertyInfo = ElementInformation.Properties;
 284            if (propertyInfo[ConfigurationStrings.MaxBufferSize].ValueOrigin != PropertyValueOrigin.Default)
 85            {
 186                binding.MaxBufferSize = MaxBufferSize;
 87            }
 288            if (MaxPendingConnections != ConnectionOrientedTransportDefaults.MaxPendingConnectionsConst)
 89            {
 190                binding.MaxPendingConnections = MaxPendingConnections;
 91            }
 292            binding.MaxOutputDelay = MaxOutputDelay;
 293            if (MaxPendingAccepts != ConnectionOrientedTransportDefaults.MaxPendingAcceptsConst)
 94            {
 195                binding.MaxPendingAccepts = MaxPendingAccepts;
 96            }
 297            binding.TransferMode = TransferMode;
 298        }
 99
 100        public override void CopyFrom(ServiceModelExtensionElement from)
 101        {
 0102            base.CopyFrom(from);
 103
 0104            ConnectionOrientedTransportElement source = (ConnectionOrientedTransportElement)from;
 0105            ConnectionBufferSize = source.ConnectionBufferSize;
 0106            HostNameComparisonMode = source.HostNameComparisonMode;
 0107            ChannelInitializationTimeout = source.ChannelInitializationTimeout;
 0108            MaxBufferSize = source.MaxBufferSize;
 0109            MaxPendingConnections = source.MaxPendingConnections;
 0110            MaxOutputDelay = source.MaxOutputDelay;
 0111            MaxPendingAccepts = source.MaxPendingAccepts;
 0112            TransferMode = source.TransferMode;
 0113        }
 114
 115        protected internal override void InitializeFrom(BindingElement bindingElement)
 116        {
 0117            base.InitializeFrom(bindingElement);
 0118            ConnectionOrientedTransportBindingElement binding = (ConnectionOrientedTransportBindingElement)bindingElemen
 0119            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.ConnectionBufferSize, binding.ConnectionBufferSize);
 0120            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.HostNameComparisonMode, binding.HostNameComparisonMod
 0121            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.ChannelInitializationTimeout, binding.ChannelInitiali
 0122            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxBufferSize, binding.MaxBufferSize);
 0123            if (binding.MaxPendingConnections > 0)
 124            {
 0125                ConfigurationProperty maxPendingConnectionsProperty = Properties[ConfigurationStrings.MaxPendingConnecti
 0126                SetPropertyValue(maxPendingConnectionsProperty, binding.MaxPendingConnections, /*ignoreLocks = */ false)
 127            }
 0128            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxOutputDelay, binding.MaxOutputDelay);
 0129            if (binding.MaxPendingAccepts > 0)
 130            {
 0131                ConfigurationProperty maxPendingAcceptsProperty = Properties[ConfigurationStrings.MaxPendingAccepts];
 0132                SetPropertyValue(maxPendingAcceptsProperty, binding.MaxPendingAccepts, /*ignoreLocks = */ false);
 133            }
 0134            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.TransferMode, binding.TransferMode);
 0135        }
 136    }
 137}