< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.StrictModeSecurityHeaderElementInferenceEngine
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/StrictModeSecurityHeaderElementInferenceEngine.cs
Line coverage
25%
Covered lines: 3
Uncovered lines: 9
Coverable lines: 12
Total lines: 38
Line coverage: 25%
Branch coverage
0%
Covered branches: 0
Total branches: 6
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%
ExecuteProcessingPassesAsync(...)100%11100%
MarkElements(...)0%660%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/StrictModeSecurityHeaderElementInferenceEngine.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.Threading.Tasks;
 5using System.Xml;
 6
 7namespace CoreWCF.Security
 8{
 9    internal sealed class StrictModeSecurityHeaderElementInferenceEngine : SecurityHeaderElementInferenceEngine
 10    {
 411        private StrictModeSecurityHeaderElementInferenceEngine() { }
 12
 9013        internal static StrictModeSecurityHeaderElementInferenceEngine Instance { get; } = new StrictModeSecurityHeaderE
 14
 8815        public override ValueTask ExecuteProcessingPassesAsync(ReceiveSecurityHeader securityHeader, XmlDictionaryReader
 16
 17        public override void MarkElements(ReceiveSecurityHeaderElementManager elementManager, bool messageSecurityMode)
 18        {
 019            bool primarySignatureFound = false;
 020            for (int position = 0; position < elementManager.Count; position++)
 21            {
 022                elementManager.GetElementEntry(position, out ReceiveSecurityHeaderEntry entry);
 023                if (entry.elementCategory == ReceiveSecurityHeaderElementCategory.Signature)
 24                {
 025                    if (!messageSecurityMode || primarySignatureFound)
 26                    {
 027                        elementManager.SetBindingMode(position, ReceiveSecurityHeaderBindingModes.Endorsing);
 28                    }
 29                    else
 30                    {
 031                        elementManager.SetBindingMode(position, ReceiveSecurityHeaderBindingModes.Primary);
 032                        primarySignatureFound = true;
 33                    }
 34                }
 35            }
 036        }
 37    }
 38}