< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Configuration.BindingFactory
Assembly: CoreWCF.ConfigurationManager
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/BindingFactory.cs
Line coverage
25%
Covered lines: 2
Uncovered lines: 6
Coverable lines: 8
Total lines: 35
Line coverage: 25%
Branch coverage
25%
Covered branches: 3
Total branches: 12
Branch coverage: 25%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
Create(...)25%121225%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.ConfigurationManager/src/CoreWCF/Configuration/BindingFactory.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 CoreWCF.Channels;
 5
 6namespace CoreWCF.Configuration
 7{
 8    internal class BindingFactory : IBindingFactory
 9    {
 10        public Binding Create(string bindingType)
 11        {
 612            if (string.IsNullOrEmpty(bindingType))
 13            {
 014                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(bindingType));
 15            }
 16
 17            // with reflection?
 18            switch (bindingType)
 19            {
 20                case "basicHttpBinding":
 021                    return new BasicHttpBinding();
 22                case "netTcpBinding":
 623                    return new NetTcpBinding();
 24                case "wsHttpBinding":
 025                    return new WSHttpBinding();
 26                case "netHttpBinding":
 027                    return new NetHttpBinding();
 28                case "customBinding":
 029                    return new CustomBinding();
 30                default:
 031                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperWarning(new BindingNotFoundException());
 32            }
 33        }
 34    }
 35}

Methods/Properties

Create(System.String)