< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Configuration.ExtensionElement
Assembly: CoreWCF.ConfigurationManager
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/ExtensionElement.cs
Line coverage
85%
Covered lines: 23
Uncovered lines: 4
Coverable lines: 27
Total lines: 87
Line coverage: 85.1%
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%
.ctor(...)50%2280%
.ctor(...)50%2280%
GetTypeName(...)100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/ExtensionElement.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    internal class ExtensionElement : ConfigurationElement
 10    {
 11        private string _typeName;
 12
 1613        public ExtensionElement()
 14        {
 1615        }
 16
 17        public ExtensionElement(string name)
 1618            : this()
 19        {
 1620            if (string.IsNullOrEmpty(name))
 21            {
 022                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(name));
 23            }
 24
 1625            Name = name;
 1626        }
 27
 28        public ExtensionElement(string name, string type)
 1629            : this(name)
 30        {
 1631            if (string.IsNullOrEmpty(type))
 32            {
 033                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(type));
 34            }
 35
 1636            Type = type;
 1637        }
 38
 39        [ConfigurationProperty(ConfigurationStrings.Name, Options = ConfigurationPropertyOptions.IsRequired | Configurat
 40        public string Name
 41        {
 49542            get { return (string)base[ConfigurationStrings.Name]; }
 43            set
 44            {
 1645                if (string.IsNullOrEmpty(value))
 46                {
 047                    value = string.Empty;
 48                }
 1649                base[ConfigurationStrings.Name] = value;
 1650            }
 51        }
 52
 53        [ConfigurationProperty(ConfigurationStrings.Type, Options = ConfigurationPropertyOptions.IsRequired)]
 54        public string Type
 55        {
 14756            get { return (string)base[ConfigurationStrings.Type]; }
 57            set
 58            {
 1659                if (string.IsNullOrEmpty(value))
 60                {
 061                    value = string.Empty;
 62                }
 63
 1664                base[ConfigurationStrings.Type] = value;
 1665            }
 66        }
 67
 68        internal string TypeName
 69        {
 70            get
 71            {
 11472                if (string.IsNullOrEmpty(_typeName))
 73                {
 1674                    _typeName = GetTypeName(Type);
 75                }
 76
 11477                return _typeName;
 78            }
 79        }
 80
 81        internal static string GetTypeName(string fullyQualifiedName)
 82        {
 1683            string typeName = fullyQualifiedName.Split(',')[0];
 1684            return typeName.Trim();
 85        }
 86    }
 87}