< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.IdentityModel.Tokens.Saml.BinarySecret
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/Saml/BinarySecret.cs
Line coverage
40%
Covered lines: 6
Uncovered lines: 9
Coverable lines: 15
Total lines: 43
Line coverage: 40%
Branch coverage
10%
Covered branches: 1
Total branches: 10
Branch coverage: 10%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%11100%
GetBytes()50%2266.66%
Equals(...)0%660%
GetHashCode()0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/IdentityModel/Tokens/Saml/BinarySecret.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    public class BinarySecret
 9    {
 110        public BinarySecret(string secret)
 11        {
 112            Value = secret;
 113        }
 14
 315        public string Value { get; }
 16
 17        public byte[] GetBytes()
 18        {
 119            if (Value == null)
 20            {
 021                return null;
 22            }
 23
 124            return Convert.FromBase64String(Value);
 25        }
 26
 27        public override bool Equals(object obj)
 28        {
 029            if (obj is not BinarySecret other)
 030                return false;
 031            if (other is null)
 032                return false;
 033            if (ReferenceEquals(this, other))
 034                return true;
 035            return string.Equals(Value, other.Value);
 36        }
 37
 38        public override int GetHashCode()
 39        {
 040            return Value != null ? Value.GetHashCode() : 0;
 41        }
 42    }
 43}