< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.SecurityKeyIdentifierClause
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/SecurityKeyIdentifierClause.cs
Line coverage
50%
Covered lines: 7
Uncovered lines: 7
Coverable lines: 14
Total lines: 57
Line coverage: 50%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%110%
.ctor(...)100%11100%
CreateKey()100%110%
Matches(...)100%110%
GetDerivationNonce()50%22100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/SecurityKeyIdentifierClause.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;
 5using CoreWCF.IdentityModel.Tokens;
 6
 7namespace CoreWCF.IdentityModel
 8{
 9    // All subclasses are required to be thread-safe and immutable
 10
 11    // Self-resolving clauses such as RSA and X509 raw data should
 12    // override CanCreateKey and return true, and implement
 13    // CreateKey()
 14
 15    public abstract class SecurityKeyIdentifierClause
 16    {
 17        private readonly byte[] _derivationNonce;
 18
 19        protected SecurityKeyIdentifierClause(string clauseType)
 020            : this(clauseType, null, 0)
 21        {
 022        }
 23
 11924        protected SecurityKeyIdentifierClause(string clauseType, byte[] nonce, int length)
 25        {
 11926            ClauseType = clauseType;
 11927            _derivationNonce = nonce;
 11928            DerivationLength = length;
 11929        }
 30
 31        public virtual bool CanCreateKey
 32        {
 033            get { return false; }
 34        }
 35
 036        public string ClauseType { get; }
 37
 138        public string Id { get; set; } = null;
 39
 40        public virtual SecurityKey CreateKey()
 41        {
 042            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(SR.KeyIdentifierClauseDo
 43        }
 44
 45        public virtual bool Matches(SecurityKeyIdentifierClause keyIdentifierClause)
 46        {
 047            return ReferenceEquals(this, keyIdentifierClause);
 48        }
 49
 50        public byte[] GetDerivationNonce()
 51        {
 2352            return (_derivationNonce != null) ? (byte[])_derivationNonce.Clone() : null;
 53        }
 54
 055        public int DerivationLength { get; }
 56    }
 57}