< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.MessagePartProtectionModeHelper
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/MessagePartProtectionMode.cs
Line coverage
33%
Covered lines: 3
Uncovered lines: 6
Coverable lines: 9
Total lines: 47
Line coverage: 33.3%
Branch coverage
25%
Covered branches: 2
Total branches: 8
Branch coverage: 25%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
GetProtectionMode(...)25%8833.33%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/MessagePartProtectionMode.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 enum MessagePartProtectionMode
 7    {
 8        None,
 9        Sign,
 10        Encrypt,
 11        SignThenEncrypt,
 12        EncryptThenSign,
 13    }
 14
 15    internal static class MessagePartProtectionModeHelper
 16    {
 17        public static MessagePartProtectionMode GetProtectionMode(bool sign, bool encrypt, bool signThenEncrypt)
 18        {
 6319            if (sign)
 20            {
 021                if (encrypt)
 22                {
 023                    if (signThenEncrypt)
 24                    {
 025                        return MessagePartProtectionMode.SignThenEncrypt;
 26                    }
 27                    else
 28                    {
 029                        return MessagePartProtectionMode.EncryptThenSign;
 30                    }
 31                }
 32                else
 33                {
 034                    return MessagePartProtectionMode.Sign;
 35                }
 36            }
 6337            else if (encrypt)
 38            {
 039                return MessagePartProtectionMode.Encrypt;
 40            }
 41            else
 42            {
 6343                return MessagePartProtectionMode.None;
 44            }
 45        }
 46    }
 47}