< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Configuration.EndpointAddressElementBase
Assembly: CoreWCF.ConfigurationManager
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/EndpointAddressElementBase.cs
Line coverage
11%
Covered lines: 2
Uncovered lines: 15
Coverable lines: 17
Total lines: 73
Line coverage: 11.7%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%
Copy(...)0%440%
InitializeFrom(...)0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/EndpointAddressElementBase.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;
 6
 7namespace CoreWCF.Configuration
 8{
 9    public class EndpointAddressElementBase : ServiceModelConfigurationElement
 10    {
 211        protected EndpointAddressElementBase()
 12        {
 213        }
 14
 15        [ConfigurationProperty(ConfigurationStrings.Address, DefaultValue = null, Options = ConfigurationPropertyOptions
 16        public Uri Address
 17        {
 018            get { return (Uri)base[ConfigurationStrings.Address]; }
 019            set { base[ConfigurationStrings.Address] = value; }
 20        }
 21
 22        [ConfigurationProperty(ConfigurationStrings.Headers)]
 23        public AddressHeaderCollectionElement Headers
 24        {
 025            get { return (AddressHeaderCollectionElement)base[ConfigurationStrings.Headers]; }
 26        }
 27
 28        //TODO: Add Identity Support
 29        //[ConfigurationProperty(ConfigurationStrings.Identity)]
 30        //public IdentityElement Identity
 31        //{
 32        //    get { return (IdentityElement)base[ConfigurationStrings.Identity]; }
 33        //}
 34
 35
 36        internal protected void Copy(EndpointAddressElementBase source)
 37        {
 038            if (IsReadOnly())
 39            {
 040                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.Format(SR.
 41            }
 042            if (null == source)
 43            {
 044                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(source));
 45            }
 46
 047            Address = source.Address;
 048            Headers.Headers = source.Headers.Headers;
 49            //TODO: Add Identity Support
 50            //PropertyInformationCollection properties = source.ElementInformation.Properties;
 51            //if (properties[ConfigurationStrings.Identity].ValueOrigin != PropertyValueOrigin.Default)
 52            //{
 53            //    this.Identity.Copy(source.Identity);
 54            //}
 055        }
 56
 57        public void InitializeFrom(EndpointAddress endpointAddress)
 58        {
 059            if (null == endpointAddress)
 60            {
 061                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(endpointAddress));
 62            }
 63
 064            SetPropertyValueIfNotDefaultValue(ConfigurationStrings.Address, endpointAddress.Uri);
 065            Headers.InitializeFrom(endpointAddress.Headers);
 66            //TODO: Add Identity Support
 67            //if (null != endpointAddress.Identity)
 68            //{
 69            //    this.Identity.InitializeFrom(endpointAddress.Identity);
 70            //}
 071        }
 72    }
 73}