< Summary - CoreWCF Coverage — PR #1766

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

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
SetPropertyValueIfNotDefaultValue(...)0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/ServiceModelConfigurationElement.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.Configuration;
 5using System.Diagnostics.Contracts;
 6
 7namespace CoreWCF.Configuration
 8{
 9    /// <summary>
 10    /// Binding-related Configuration elements use this base class for WCF-wide commonalities
 11    /// </summary>
 12    public abstract class ServiceModelConfigurationElement : ConfigurationElement
 13    {
 14        /// <summary>
 15        /// Used by InitializeFrom() pattern to avoid writing default values to generated .config files.
 16        /// </summary>
 17        /// <typeparam name="T"></typeparam>
 18        /// <param name="propertyName">ConfigurationProperty.Name for the configuration property to set</param>
 19        /// <param name="value">Value to set</param>
 20        protected void SetPropertyValueIfNotDefaultValue<T>(string propertyName, T value)
 21        {
 022            ConfigurationProperty configurationProperty = Properties[propertyName];
 23            Contract.Assert(configurationProperty != null, "Parameter 'propertyName' should be the name of a configurati
 24            Contract.Assert(configurationProperty.Type.IsAssignableFrom(typeof(T)), "Parameter 'propertyName' should be 
 25
 026            if (!object.Equals(value, configurationProperty.DefaultValue))
 27            {
 028                SetPropertyValue(configurationProperty, value, /*ignoreLocks = */ false);
 29            }
 030        }
 31
 32    }
 33}