< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.Tokens.SamlNameIdentifierClaimResource
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/SamlNameIdentifierClaimResource.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 22
Coverable lines: 22
Total lines: 63
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
OnDeserialized(...)0%220%
.ctor(...)0%220%
Equals(...)0%10100%
GetHashCode()100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/SamlNameIdentifierClaimResource.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.Runtime.Serialization;
 5
 6namespace CoreWCF.IdentityModel.Tokens
 7{
 8    [DataContract]
 9    public class SamlNameIdentifierClaimResource
 10    {
 11        [DataMember]
 12        private readonly string nameQualifier;
 13
 14        [DataMember]
 15        private readonly string format;
 16
 17        [DataMember]
 18        private readonly string name;
 19
 20        [OnDeserialized]
 21        private void OnDeserialized(StreamingContext ctx)
 22        {
 023            if (string.IsNullOrEmpty(name))
 024                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(nameof(name));
 025        }
 26
 027        public SamlNameIdentifierClaimResource(string name, string nameQualifier, string format)
 28        {
 029            if (string.IsNullOrEmpty(name))
 030                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument(nameof(name));
 31
 032            this.name = name;
 033            this.nameQualifier = nameQualifier;
 034            this.format = format;
 035        }
 36
 037        public string NameQualifier => nameQualifier;
 38
 039        public string Format => format;
 40
 041        public string Name => name;
 42
 43        public override bool Equals(object obj)
 44        {
 045            if (obj == null)
 046                return false;
 47
 048            if (ReferenceEquals(this, obj))
 049                return true;
 50
 051            SamlNameIdentifierClaimResource rhs = obj as SamlNameIdentifierClaimResource;
 052            if (rhs == null)
 053                return false;
 54
 055            return ((nameQualifier == rhs.nameQualifier) && (format == rhs.format) && (name == rhs.name));
 56        }
 57
 58        public override int GetHashCode()
 59        {
 060            return name.GetHashCode();
 61        }
 62    }
 63}