< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.Tokens.Saml.SecurityKeyIdentifier
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/Saml/SecurityKeyIdentifier.cs
Line coverage
44%
Covered lines: 8
Uncovered lines: 10
Coverable lines: 18
Total lines: 68
Line coverage: 44.4%
Branch coverage
0%
Covered branches: 0
Total branches: 10
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%11100%
Equals(...)0%10100%
GetHashCode()100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/Saml/SecurityKeyIdentifier.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;
 5
 6namespace CoreWCF.IdentityModel.Tokens.Saml
 7{
 8    /// <summary>
 9    /// Represents the KeyIdentifier of X509Data as per:  TODO - need url to STRTransform
 10    /// </summary>
 11    public class SecurityKeyIdentifier
 12    {
 13        /// <summary>
 14        /// Creates an SecurityKeyIdentifier using the specified KeyIdentifierType and EncodingType.
 15        /// </summary>
 316        public SecurityKeyIdentifier(string valueType, string encodingType, string value)
 17        {
 318            ValueType = valueType;
 319            EncodingType = encodingType;
 320            Value = value;
 321        }
 22
 23        /// <summary>
 24        /// Gets the ValueType of the SecurityKeyIdentifier
 25        /// </summary>
 726        public string ValueType { get; }
 27
 28        /// <summary>
 29        /// Gets the EncodingType of the SecurityKeyIdentifier.
 30        /// </summary>
 731        public string EncodingType { get; }
 32
 33        /// <summary>
 34        /// Gets the value of the SecurityKeyIdentifier.
 35        /// </summary>
 1036        public string Value { get; set; }
 37
 38        /// <summary>
 39        /// Determines whether the specified object is equal to the current object.
 40        /// </summary>
 41        /// <param name="obj">The object to compare with the current object.</param>
 42        /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns>
 43        public override bool Equals(object obj)
 44        {
 045            if (obj is not SecurityKeyIdentifier other)
 046                return false;
 47
 048            if (other is null)
 049                return false;
 50
 051            if (ReferenceEquals(this, other))
 052                return true;
 53
 054            return string.Equals(ValueType, other.ValueType) &&
 055                   string.Equals(EncodingType, other.EncodingType) &&
 056                   string.Equals(Value, other.Value);
 57        }
 58
 59        /// <summary>
 60        /// Serves as the default hash function.
 61        /// </summary>
 62        /// <returns>A hash code for the current object.</returns>
 63        public override int GetHashCode()
 64        {
 065            return HashCode.Combine(ValueType, EncodingType, Value);
 66        }
 67    }
 68}