< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.UnixDomainSocketBinding
Assembly: CoreWCF.UnixDomainSocket
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.UnixDomainSocket/src/CoreWCF/UnixDomainSocketBinding.cs
Line coverage
63%
Covered lines: 23
Uncovered lines: 13
Coverable lines: 36
Total lines: 103
Line coverage: 63.8%
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%
Initialize()100%11100%
CreateBindingElements()100%22100%
CreateTransportSecurity()100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.UnixDomainSocket/src/CoreWCF/UnixDomainSocketBinding.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.Channels;
 7
 8namespace CoreWCF
 9{
 10    public class UnixDomainSocketBinding : Binding
 11    {
 12        // private BindingElements
 13        private UnixDomainSocketTransportBindingElement _transport;
 14        private BinaryMessageEncodingBindingElement _encoding;
 615        private UnixDomainSocketSecurity _security = new UnixDomainSocketSecurity();
 16
 1817        public UnixDomainSocketBinding() { Initialize(); }
 18        public UnixDomainSocketBinding(UnixDomainSocketSecurityMode securityMode)
 319            : this()
 20        {
 321            _security.Mode = securityMode;
 322        }
 23
 24        public TransferMode TransferMode
 25        {
 026            get { return _transport.TransferMode; }
 027            set { _transport.TransferMode = value; }
 28        }
 29
 30        public HostNameComparisonMode HostNameComparisonMode
 31        {
 032            get { return _transport.HostNameComparisonMode; }
 033            set { _transport.HostNameComparisonMode = value; }
 34        }
 35
 36        public long MaxReceivedMessageSize
 37        {
 038            get { return _transport.MaxReceivedMessageSize; }
 039            set { _transport.MaxReceivedMessageSize = value; }
 40        }
 41
 42        public XmlDictionaryReaderQuotas ReaderQuotas
 43        {
 044            get { return _encoding.ReaderQuotas; }
 45            set
 46            {
 047                if (value == null)
 48                {
 049                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(value));
 50                }
 51
 052                value.CopyTo(_encoding.ReaderQuotas);
 053            }
 54        }
 55
 056        public override string Scheme { get { return _transport.Scheme; } }
 57
 58        public EnvelopeVersion EnvelopeVersion
 59        {
 060            get { return EnvelopeVersion.Soap12; }
 61        }
 62
 63        public UnixDomainSocketSecurity Security
 64        {
 265            get { return _security; }
 66            set
 67            {
 368                _security = value ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(value));
 369            }
 70        }
 71
 72        private void Initialize()
 73        {
 674            _transport = new UnixDomainSocketTransportBindingElement();
 675            _encoding = new BinaryMessageEncodingBindingElement();
 676        }
 77
 78        public override BindingElementCollection CreateBindingElements()
 79        {
 80            // return collection of BindingElements
 5081            BindingElementCollection bindingElements = new BindingElementCollection
 5082            {
 5083                // order of BindingElements is important
 5084                // add encoding
 5085                _encoding
 5086            };
 87
 88            // add transport security
 5089            BindingElement transportSecurity = CreateTransportSecurity();
 4790            if (transportSecurity != null)
 91            {
 3292                bindingElements.Add(transportSecurity);
 93            }
 4794            bindingElements.Add(_transport);
 4795            return bindingElements.Clone();
 96        }
 97
 98        private BindingElement CreateTransportSecurity()
 99        {
 50100            return _security.CreateTransportSecurity();
 101        }
 102    }
 103}