< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.WSFederationHttpSecurity
Assembly: CoreWCF.Http
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Http/src/CoreWCF/WSFederationHttpSecurity.cs
Line coverage
81%
Covered lines: 13
Uncovered lines: 3
Coverable lines: 16
Total lines: 62
Line coverage: 81.2%
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
.ctor()100%11100%
.ctor(...)50%22100%
CreateMessageSecurity(...)75%4466.66%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Http/src/CoreWCF/WSFederationHttpSecurity.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 System.ComponentModel;
 6using CoreWCF.Channels;
 7using CoreWCF.Runtime;
 8using CoreWCF.Security;
 9
 10namespace CoreWCF
 11{
 12    public sealed class WSFederationHttpSecurity
 13    {
 14        internal const WSFederationHttpSecurityMode DefaultMode = WSFederationHttpSecurityMode.Message;
 15        private WSFederationHttpSecurityMode _mode;
 16        private FederatedMessageSecurityOverHttp _messageSecurity;
 17
 18        public WSFederationHttpSecurity()
 219            : this(DefaultMode, new FederatedMessageSecurityOverHttp())
 20        {
 221        }
 22
 223        private WSFederationHttpSecurity(WSFederationHttpSecurityMode mode, FederatedMessageSecurityOverHttp messageSecu
 24        {
 25            Fx.Assert(WSFederationHttpSecurityModeHelper.IsDefined(mode), string.Format("Invalid WSFederationHttpSecurit
 226            _mode = mode;
 227            _messageSecurity = messageSecurity == null ? new FederatedMessageSecurityOverHttp() : messageSecurity;
 228        }
 29
 30        public WSFederationHttpSecurityMode Mode
 31        {
 26432            get { return _mode; }
 33            set
 34            {
 235                if (!WSFederationHttpSecurityModeHelper.IsDefined(value))
 36                {
 037                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 38                }
 239                _mode = value;
 240            }
 41        }
 42
 43        public FederatedMessageSecurityOverHttp Message
 44        {
 445            get { return _messageSecurity; }
 046            set { _messageSecurity = value; }
 47        }
 48
 49        internal SecurityBindingElement CreateMessageSecurity(bool isReliableSessionEnabled, MessageSecurityVersion vers
 50        {
 5051            if (_mode == WSFederationHttpSecurityMode.Message || _mode == WSFederationHttpSecurityMode.TransportWithMess
 52            {
 5053                return _messageSecurity.CreateSecurityBindingElement(Mode == WSFederationHttpSecurityMode.TransportWithM
 54            }
 55            else
 56            {
 057                return null;
 58            }
 59        }
 60
 61    }
 62}