< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.SecurityCapabilities
Assembly: CoreWCF.Queue
File(s): /home/runner/work/CoreWCF/CoreWCF/src/Common/src/CoreWCF/Channels/SecurityCapabilities.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 29
Coverable lines: 29
Total lines: 68
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 14
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%110%
IsEqual(...)0%14140%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/Common/src/CoreWCF/Channels/SecurityCapabilities.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.Net.Security;
 5
 6namespace CoreWCF.Channels
 7{
 8    internal class SecurityCapabilities : ISecurityCapabilities
 9    {
 010        public SecurityCapabilities(bool supportsClientAuth, bool supportsServerAuth, bool supportsClientWindowsIdentity
 011            ProtectionLevel requestProtectionLevel, ProtectionLevel responseProtectionLevel)
 12        {
 013            SupportsClientAuthentication = supportsClientAuth;
 014            SupportsServerAuthentication = supportsServerAuth;
 015            SupportsClientWindowsIdentity = supportsClientWindowsIdentity;
 016            SupportedRequestProtectionLevel = requestProtectionLevel;
 017            SupportedResponseProtectionLevel = responseProtectionLevel;
 018        }
 19
 020        public ProtectionLevel SupportedRequestProtectionLevel { get; }
 021        public ProtectionLevel SupportedResponseProtectionLevel { get; }
 022        public bool SupportsClientAuthentication { get; }
 023        public bool SupportsClientWindowsIdentity { get; }
 024        public bool SupportsServerAuthentication { get; }
 25
 026        private static SecurityCapabilities None => new SecurityCapabilities(false, false, false, ProtectionLevel.None, 
 27
 28        internal static bool IsEqual(ISecurityCapabilities capabilities1, ISecurityCapabilities capabilities2)
 29        {
 030            if (capabilities1 == null)
 31            {
 032                capabilities1 = None;
 33            }
 34
 035            if (capabilities2 == null)
 36            {
 037                capabilities2 = None;
 38            }
 39
 040            if (capabilities1.SupportedRequestProtectionLevel != capabilities2.SupportedRequestProtectionLevel)
 41            {
 042                return false;
 43            }
 44
 045            if (capabilities1.SupportedResponseProtectionLevel != capabilities2.SupportedResponseProtectionLevel)
 46            {
 047                return false;
 48            }
 49
 050            if (capabilities1.SupportsClientAuthentication != capabilities2.SupportsClientAuthentication)
 51            {
 052                return false;
 53            }
 54
 055            if (capabilities1.SupportsClientWindowsIdentity != capabilities2.SupportsClientWindowsIdentity)
 56            {
 057                return false;
 58            }
 59
 060            if (capabilities1.SupportsServerAuthentication != capabilities2.SupportsServerAuthentication)
 61            {
 062                return false;
 63            }
 64
 065            return true;
 66        }
 67    }
 68}