< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.WSHttpBinding
Assembly: CoreWCF.Http
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Http/src/CoreWCF/WSHttpBinding.cs
Line coverage
85%
Covered lines: 18
Uncovered lines: 3
Coverable lines: 21
Total lines: 63
Line coverage: 85.7%
Branch coverage
62%
Covered branches: 5
Total branches: 8
Branch coverage: 62.5%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.cctor()100%11100%
.ctor()100%11100%
.ctor(...)100%11100%
.ctor(...)100%11100%
.ctor(...)0%220%
CreateBindingElements()100%11100%
GetTransport()100%44100%
CreateMessageSecurity()100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Http/src/CoreWCF/WSHttpBinding.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 CoreWCF.Channels;
 6
 7namespace CoreWCF
 8{
 9    public class WSHttpBinding : WSHttpBindingBase
 10    {
 211        private static readonly MessageSecurityVersion s_WSMessageSecurityVersion = MessageSecurityVersion.WSSecurity11W
 12
 3913        private WSHTTPSecurity _security = new WSHTTPSecurity();
 14
 1215        public WSHttpBinding() : base() { }
 16
 4617        public WSHttpBinding(SecurityMode securityMode) : this(securityMode, false) { }
 18
 3319        public WSHttpBinding(SecurityMode securityMode, bool reliableSessionEnabled) : base(reliableSessionEnabled)
 20        {
 3321            _security.Mode = securityMode;
 3322        }
 23
 024        internal WSHttpBinding(WSHTTPSecurity security, bool reliableSessionEnabled) : base(reliableSessionEnabled)
 25        {
 026            _security = security ?? new WSHTTPSecurity();
 027        }
 28
 29        public WSHTTPSecurity Security
 30        {
 17731            get { return _security; }
 32            set
 33            {
 634                _security = value ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException
 635            }
 36        }
 37
 38        public override BindingElementCollection CreateBindingElements()
 39        {
 29340            return base.CreateBindingElements();
 41        }
 42
 43        protected override TransportBindingElement GetTransport()
 44        {
 38445            if (_security.Mode == SecurityMode.None || _security.Mode == SecurityMode.Message)
 46            {
 16047                HttpTransport.ExtendedProtectionPolicy = _security.Transport.ExtendedProtectionPolicy;
 16048                return HttpTransport;
 49            }
 50            else
 51            {
 22452                _security.ApplyTransportSecurity(HttpsTransport);
 22453                _security.ApplyAuthorizationPolicySupport(HttpsTransport);
 22454                return HttpsTransport;
 55            }
 56        }
 57
 58        protected override SecurityBindingElement CreateMessageSecurity()
 59        {
 15260            return _security.CreateMessageSecurity(false, s_WSMessageSecurityVersion);
 61        }
 62    }
 63}