< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Configuration.LocalServiceSecuritySettingsElement
Assembly: CoreWCF.ConfigurationManager
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/LocalServiceSecuritySettingsElement.cs
Line coverage
38%
Covered lines: 31
Uncovered lines: 50
Coverable lines: 81
Total lines: 191
Line coverage: 38.2%
Branch coverage
30%
Covered branches: 3
Total branches: 10
Branch coverage: 30%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
ApplyConfiguration(...)75%4494.44%
InitializeFrom(...)0%220%
CopyFrom(...)0%440%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/LocalServiceSecuritySettingsElement.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.ComponentModel;
 6using System.Configuration;
 7using CoreWCF.Channels;
 8
 9namespace CoreWCF.Configuration
 10{
 11    public sealed class LocalServiceSecuritySettingsElement : ServiceModelConfigurationElement
 12    {
 13        [ConfigurationProperty(ConfigurationStrings.DetectReplays, DefaultValue = SecurityBindingDefaults.DefaultDetectR
 14        public bool DetectReplays
 15        {
 116            get { return (bool)base[ConfigurationStrings.DetectReplays]; }
 017            set { base[ConfigurationStrings.DetectReplays] = value; }
 18        }
 19
 20        [ConfigurationProperty(ConfigurationStrings.IssuedCookieLifetime, DefaultValue = SecurityBindingDefaults.Default
 21        [TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
 22        public TimeSpan IssuedCookieLifetime
 23        {
 124            get { return (TimeSpan)base[ConfigurationStrings.IssuedCookieLifetime]; }
 025            set { base[ConfigurationStrings.IssuedCookieLifetime] = value; }
 26        }
 27
 28        [ConfigurationProperty(ConfigurationStrings.MaxStatefulNegotiations, DefaultValue = SecurityBindingDefaults.Defa
 29        [IntegerValidator(MinValue = 0)]
 30        public int MaxStatefulNegotiations
 31        {
 132            get { return (int)base[ConfigurationStrings.MaxStatefulNegotiations]; }
 033            set { base[ConfigurationStrings.MaxStatefulNegotiations] = value; }
 34        }
 35
 36        [ConfigurationProperty(ConfigurationStrings.ReplayCacheSize, DefaultValue = SecurityBindingDefaults.DefaultMaxCa
 37        [IntegerValidator(MinValue = 1)]
 38        public int ReplayCacheSize
 39        {
 140            get { return (int)base[ConfigurationStrings.ReplayCacheSize]; }
 041            set { base[ConfigurationStrings.ReplayCacheSize] = value; }
 42        }
 43
 44        [ConfigurationProperty(ConfigurationStrings.MaxClockSkew, DefaultValue = SecurityBindingDefaults.DefaultMaxClock
 45        [TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
 46        public TimeSpan MaxClockSkew
 47        {
 148            get { return (TimeSpan)base[ConfigurationStrings.MaxClockSkew]; }
 049            set { base[ConfigurationStrings.MaxClockSkew] = value; }
 50        }
 51
 52        [ConfigurationProperty(ConfigurationStrings.NegotiationTimeout, DefaultValue = SecurityBindingDefaults.DefaultSe
 53        [TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
 54        public TimeSpan NegotiationTimeout
 55        {
 156            get { return (TimeSpan)base[ConfigurationStrings.NegotiationTimeout]; }
 057            set { base[ConfigurationStrings.NegotiationTimeout] = value; }
 58        }
 59
 60        [ConfigurationProperty(ConfigurationStrings.ReplayWindow, DefaultValue = SecurityBindingDefaults.DefaultReplayWi
 61        [TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
 62        public TimeSpan ReplayWindow
 63        {
 164            get { return (TimeSpan)base[ConfigurationStrings.ReplayWindow]; }
 065            set { base[ConfigurationStrings.ReplayWindow] = value; }
 66        }
 67
 68        [ConfigurationProperty(ConfigurationStrings.InactivityTimeout, DefaultValue = SecurityBindingDefaults.DefaultIna
 69        [TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
 70        public TimeSpan InactivityTimeout
 71        {
 172            get { return (TimeSpan)base[ConfigurationStrings.InactivityTimeout]; }
 073            set { base[ConfigurationStrings.InactivityTimeout] = value; }
 74        }
 75
 76        [ConfigurationProperty(ConfigurationStrings.SessionKeyRenewalInterval, DefaultValue = SecurityBindingDefaults.De
 77        [TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
 78        public TimeSpan SessionKeyRenewalInterval
 79        {
 180            get { return (TimeSpan)base[ConfigurationStrings.SessionKeyRenewalInterval]; }
 081            set { base[ConfigurationStrings.SessionKeyRenewalInterval] = value; }
 82        }
 83
 84        [ConfigurationProperty(ConfigurationStrings.SessionKeyRolloverInterval, DefaultValue = SecurityBindingDefaults.D
 85        [TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
 86        public TimeSpan SessionKeyRolloverInterval
 87        {
 188            get { return (TimeSpan)base[ConfigurationStrings.SessionKeyRolloverInterval]; }
 089            set { base[ConfigurationStrings.SessionKeyRolloverInterval] = value; }
 90        }
 91
 92        [ConfigurationProperty(ConfigurationStrings.ReconnectTransportOnFailure, DefaultValue = SecurityBindingDefaults.
 93        public bool ReconnectTransportOnFailure
 94        {
 195            get { return (bool)base[ConfigurationStrings.ReconnectTransportOnFailure]; }
 096            set { base[ConfigurationStrings.ReconnectTransportOnFailure] = value; }
 97        }
 98
 99        [ConfigurationProperty(ConfigurationStrings.MaxPendingSessions, DefaultValue = SecurityBindingDefaults.DefaultMa
 100        [IntegerValidator(MinValue = 1)]
 101        public int MaxPendingSessions
 102        {
 1103            get { return (int)base[ConfigurationStrings.MaxPendingSessions]; }
 0104            set { base[ConfigurationStrings.MaxPendingSessions] = value; }
 105        }
 106
 107        [ConfigurationProperty(ConfigurationStrings.MaxCachedCookies, DefaultValue = SecurityBindingDefaults.DefaultServ
 108        [IntegerValidator(MinValue = 0)]
 109        public int MaxCachedCookies
 110        {
 1111            get { return (int)base[ConfigurationStrings.MaxCachedCookies]; }
 0112            set { base[ConfigurationStrings.MaxCachedCookies] = value; }
 113        }
 114
 115        [ConfigurationProperty(ConfigurationStrings.TimestampValidityDuration, DefaultValue = SecurityBindingDefaults.De
 116        [TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
 117        public TimeSpan TimestampValidityDuration
 118        {
 1119            get { return (TimeSpan)base[ConfigurationStrings.TimestampValidityDuration]; }
 0120            set { base[ConfigurationStrings.TimestampValidityDuration] = value; }
 121        }
 122
 123        internal void ApplyConfiguration(LocalServiceSecuritySettings settings)
 124        {
 1125            if (settings == null)
 126            {
 0127                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(settings));
 128            }
 1129            if (PropertyValueOrigin.Default != ElementInformation.Properties[ConfigurationStrings.DetectReplays].ValueOr
 1130                settings.DetectReplays = DetectReplays;
 1131            settings.IssuedCookieLifetime = IssuedCookieLifetime;
 1132            settings.MaxClockSkew = MaxClockSkew;
 1133            settings.MaxPendingSessions = MaxPendingSessions;
 1134            settings.MaxStatefulNegotiations = MaxStatefulNegotiations;
 1135            settings.NegotiationTimeout = NegotiationTimeout;
 1136            settings.ReconnectTransportOnFailure = ReconnectTransportOnFailure;
 1137            settings.ReplayCacheSize = ReplayCacheSize;
 1138            settings.ReplayWindow = ReplayWindow;
 1139            settings.SessionKeyRenewalInterval = SessionKeyRenewalInterval;
 1140            settings.SessionKeyRolloverInterval = SessionKeyRolloverInterval;
 1141            settings.InactivityTimeout = InactivityTimeout;
 1142            settings.TimestampValidityDuration = TimestampValidityDuration;
 1143            settings.MaxCachedCookies = MaxCachedCookies;
 1144        }
 145
 146        internal void InitializeFrom(LocalServiceSecuritySettings settings)
 147        {
 0148            if (settings == null)
 149            {
 0150                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(settings));
 151            }
 0152            DetectReplays = settings.DetectReplays; // can't use default value optimization here because runtime default
 0153            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.IssuedCookieLifetime, settings.IssuedCookieLifetime);
 0154            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxClockSkew, settings.MaxClockSkew);
 0155            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxPendingSessions, settings.MaxPendingSessions);
 0156            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxStatefulNegotiations, settings.MaxStatefulNegotiat
 0157            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.NegotiationTimeout, settings.NegotiationTimeout);
 0158            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.ReconnectTransportOnFailure, settings.ReconnectTransp
 0159            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.ReplayCacheSize, settings.ReplayCacheSize);
 0160            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.ReplayWindow, settings.ReplayWindow);
 0161            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.SessionKeyRenewalInterval, settings.SessionKeyRenewal
 0162            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.SessionKeyRolloverInterval, settings.SessionKeyRollov
 0163            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.InactivityTimeout, settings.InactivityTimeout);
 0164            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.TimestampValidityDuration, settings.TimestampValidity
 0165            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxCachedCookies, settings.MaxCachedCookies);
 0166        }
 167
 168        internal void CopyFrom(LocalServiceSecuritySettingsElement source)
 169        {
 0170            if (source == null)
 171            {
 0172                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(source));
 173            }
 0174            if (PropertyValueOrigin.Default != source.ElementInformation.Properties[ConfigurationStrings.DetectReplays].
 0175                DetectReplays = source.DetectReplays;
 0176            IssuedCookieLifetime = source.IssuedCookieLifetime;
 0177            MaxClockSkew = source.MaxClockSkew;
 0178            MaxPendingSessions = source.MaxPendingSessions;
 0179            MaxStatefulNegotiations = source.MaxStatefulNegotiations;
 0180            NegotiationTimeout = source.NegotiationTimeout;
 0181            ReconnectTransportOnFailure = source.ReconnectTransportOnFailure;
 0182            ReplayCacheSize = source.ReplayCacheSize;
 0183            ReplayWindow = source.ReplayWindow;
 0184            SessionKeyRenewalInterval = source.SessionKeyRenewalInterval;
 0185            SessionKeyRolloverInterval = source.SessionKeyRolloverInterval;
 0186            InactivityTimeout = source.InactivityTimeout;
 0187            TimestampValidityDuration = source.TimestampValidityDuration;
 0188            MaxCachedCookies = source.MaxCachedCookies;
 0189        }
 190    }
 191}