< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.Tokens.X509SecurityTokenReferenceStyleHelper
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/Tokens/X509KeyIdentifierClauseType.cs
Line coverage
77%
Covered lines: 7
Uncovered lines: 2
Coverable lines: 9
Total lines: 37
Line coverage: 77.7%
Branch coverage
80%
Covered branches: 8
Total branches: 10
Branch coverage: 80%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
IsDefined(...)87.5%88100%
Validate(...)50%2250%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/Tokens/X509KeyIdentifierClauseType.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.ComponentModel;
 5
 6namespace CoreWCF.Security.Tokens
 7{
 8    public enum X509KeyIdentifierClauseType
 9    {
 10        Any = 0,
 11        Thumbprint = 1,
 12        IssuerSerial = 2,
 13        SubjectKeyIdentifier = 3,
 14        RawDataKeyIdentifier = 4
 15    }
 16
 17    internal static class X509SecurityTokenReferenceStyleHelper
 18    {
 19        public static bool IsDefined(X509KeyIdentifierClauseType value)
 20        {
 3321            return (value == X509KeyIdentifierClauseType.Any
 3322                || value == X509KeyIdentifierClauseType.IssuerSerial
 3323                || value == X509KeyIdentifierClauseType.SubjectKeyIdentifier
 3324                || value == X509KeyIdentifierClauseType.Thumbprint
 3325                || value == X509KeyIdentifierClauseType.RawDataKeyIdentifier);
 26        }
 27
 28        public static void Validate(X509KeyIdentifierClauseType value)
 29        {
 3330            if (!IsDefined(value))
 31            {
 032                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException(nameof(value)
 033                    typeof(X509KeyIdentifierClauseType)));
 34            }
 3335        }
 36    }
 37}