< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.ReceiveSecurityHeaderEntry
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/ReceiveSecurityHeaderEntry.cs
Line coverage
53%
Covered lines: 8
Uncovered lines: 7
Coverable lines: 15
Total lines: 57
Line coverage: 53.3%
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
MatchesId(...)0%660%
PreserveIdBeforeDecryption()100%110%
SetElement(...)100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/ReceiveSecurityHeaderEntry.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
 4namespace CoreWCF.Security
 5{
 6    internal struct ReceiveSecurityHeaderEntry
 7    {
 8        internal ReceiveSecurityHeaderElementCategory elementCategory;
 9        internal object element;
 10        internal ReceiveSecurityHeaderBindingModes bindingMode;
 11        internal string id;
 12        internal string encryptedFormId;
 13        internal string encryptedFormWsuId;
 14        internal bool signed;
 15        internal bool encrypted;
 16        internal byte[] decryptedBuffer;
 17        internal TokenTracker supportingTokenTracker;
 18        internal bool doubleEncrypted;
 19
 20        public bool MatchesId(string id, bool requiresEncryptedFormId)
 21        {
 022            if (doubleEncrypted)
 23            {
 024                return (encryptedFormId == id || encryptedFormWsuId == id);
 25            }
 26            else
 27            {
 028                if (requiresEncryptedFormId)
 29                {
 030                    return encryptedFormId == id;
 31                }
 32                else
 33                {
 034                    return this.id == id;
 35                }
 36            }
 37        }
 38
 39        public void PreserveIdBeforeDecryption()
 40        {
 041            encryptedFormId = id;
 042        }
 43
 44        public void SetElement(
 45            ReceiveSecurityHeaderElementCategory elementCategory, object element,
 46            ReceiveSecurityHeaderBindingModes bindingMode, string id, bool encrypted, byte[] decryptedBuffer, TokenTrack
 47        {
 18148            this.elementCategory = elementCategory;
 18149            this.element = element;
 18150            this.bindingMode = bindingMode;
 18151            this.encrypted = encrypted;
 18152            this.decryptedBuffer = decryptedBuffer;
 18153            this.supportingTokenTracker = supportingTokenTracker;
 18154            this.id = id;
 18155        }
 56    }
 57}