< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.MessageEncodingBindingElement
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Channels/MessageEncodingBindingElement.cs
Line coverage
61%
Covered lines: 8
Uncovered lines: 5
Coverable lines: 13
Total lines: 52
Line coverage: 61.5%
Branch coverage
50%
Covered branches: 3
Total branches: 6
Branch coverage: 50%
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(...)100%11100%
GetProperty(...)75%4480%
CheckEncodingVersion(...)100%110%
IsMatch(...)0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Channels/MessageEncodingBindingElement.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
 4namespace CoreWCF.Channels
 5{
 6    public abstract class MessageEncodingBindingElement : BindingElement
 7    {
 21088        protected MessageEncodingBindingElement()
 9        {
 210810        }
 11
 12        protected MessageEncodingBindingElement(MessageEncodingBindingElement elementToBeCloned)
 1075013            : base(elementToBeCloned)
 14        {
 1075015        }
 16
 17        public abstract MessageVersion MessageVersion { get; set; }
 18
 19        public abstract MessageEncoderFactory CreateMessageEncoderFactory();
 20
 21        public override T GetProperty<T>(BindingContext context)
 22        {
 670123            if (context == null)
 24            {
 025                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(context));
 26            }
 670127            if (typeof(T) == typeof(MessageVersion))
 28            {
 456729                return (T)(object)MessageVersion;
 30            }
 31            else
 32            {
 213433                return context.GetInnerProperty<T>();
 34            }
 35        }
 36
 37        protected virtual bool CheckEncodingVersion(EnvelopeVersion version)
 38        {
 039            return false;
 40        }
 41
 42        protected override bool IsMatch(BindingElement b)
 43        {
 044            if (!(b is MessageEncodingBindingElement encoding))
 45            {
 046                return false;
 47            }
 48
 049            return true;
 50        }
 51    }
 52}