< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.ByteStreamMessageEncodingBindingElement
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Channels/ByteStreamMessageEncodingBindingElement.cs
Line coverage
46%
Covered lines: 12
Uncovered lines: 14
Coverable lines: 26
Total lines: 81
Line coverage: 46.1%
Branch coverage
40%
Covered branches: 4
Total branches: 10
Branch coverage: 40%
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%22100%
.ctor(...)100%110%
GetProperty(...)50%4466.66%
CreateMessageEncoderFactory()100%11100%
Clone()100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Channels/ByteStreamMessageEncodingBindingElement.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.ComponentModel;
 5using System.Xml;
 6using CoreWCF.Runtime;
 7
 8namespace CoreWCF.Channels
 9{
 10    public sealed class ByteStreamMessageEncodingBindingElement : MessageEncodingBindingElement
 11    {
 12        private readonly XmlDictionaryReaderQuotas _readerQuotas;
 13        private bool _moveBodyReaderToContent;
 14
 215        public ByteStreamMessageEncodingBindingElement() : this((XmlDictionaryReaderQuotas)null)
 16        {
 217        }
 18
 3519        public ByteStreamMessageEncodingBindingElement(XmlDictionaryReaderQuotas quota)
 20        {
 3521            _readerQuotas = new XmlDictionaryReaderQuotas();
 3522            if (quota != null)
 23            {
 3324                quota.CopyTo(_readerQuotas);
 25            }
 3526        }
 27
 28        private ByteStreamMessageEncodingBindingElement(ByteStreamMessageEncodingBindingElement byteStreamEncoderBinding
 029            : this(byteStreamEncoderBindingElement._readerQuotas)
 30        {
 031        }
 32
 33        public override MessageVersion MessageVersion
 34        {
 35            get
 36            {
 037                return MessageVersion.None;
 38            }
 39            set
 40            {
 041                if (value != MessageVersion.None)
 42                {
 043                    throw Fx.Exception.Argument(nameof(MessageVersion), SR.Format(SR.ByteStreamMessageEncoderMessageVers
 44                }
 045            }
 46        }
 47
 48        public XmlDictionaryReaderQuotas ReaderQuotas
 49        {
 50            get
 51            {
 052                return _readerQuotas;
 53            }
 54            set
 55            {
 056                if (value == null)
 057                    throw Fx.Exception.ArgumentNull(nameof(ReaderQuotas));
 058                value.CopyTo(ReaderQuotas);
 059            }
 60        }
 61
 62        public override T GetProperty<T>(BindingContext context)
 63        {
 3364            if (context == null)
 65            {
 066                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(context));
 67            }
 3368            if (typeof(T).FullName == "CoreWCF.Channels.WebMessageEncoderFactory+WebMessageEncoder")
 69            {
 3370                _moveBodyReaderToContent = true;
 3371                return null;
 72            }
 73
 074            return base.GetProperty<T>(context);
 75        }
 76
 3577        public override MessageEncoderFactory CreateMessageEncoderFactory() => new ByteStreamMessageEncoderFactory(_read
 78
 079        public override BindingElement Clone() => new ByteStreamMessageEncodingBindingElement(this);
 80    }
 81}