< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.SignatureConfirmations
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/SignatureConfirmations.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 22
Coverable lines: 22
Total lines: 58
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 6
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%110%
.ctor()100%110%
AddConfirmation(...)0%220%
GetConfirmation(...)0%440%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/SignatureConfirmations.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.Security
 7{
 8    internal class SignatureConfirmations
 9    {
 10        private SignatureConfirmation[] _confirmations;
 11
 12        private struct SignatureConfirmation
 13        {
 14            private byte[] _value;
 15
 16            public SignatureConfirmation(byte[] value)
 17            {
 018                _value = value;
 019            }
 20
 021            public byte[] Value { get => _value; set => _value = value; }
 22        }
 23
 024        public SignatureConfirmations()
 25        {
 026            _confirmations = new SignatureConfirmation[1];
 027            Count = 0;
 028        }
 29
 030        public int Count { get; private set; }
 31
 32        public void AddConfirmation(byte[] value, bool encrypted)
 33        {
 034            if (_confirmations.Length == Count)
 35            {
 036                SignatureConfirmation[] newConfirmations = new SignatureConfirmation[Count * 2];
 037                Array.Copy(_confirmations, 0, newConfirmations, 0, Count);
 038                _confirmations = newConfirmations;
 39            }
 040            _confirmations[Count] = new SignatureConfirmation(value);
 041            ++Count;
 042            IsMarkedForEncryption |= encrypted;
 043        }
 44
 45        public void GetConfirmation(int index, out byte[] value, out bool encrypted)
 46        {
 047            if (index < 0 || index >= Count)
 48            {
 049                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(index),
 50            }
 51
 052            value = _confirmations[index].Value;
 053            encrypted = IsMarkedForEncryption;
 054        }
 55
 056        public bool IsMarkedForEncryption { get; private set; }
 57    }
 58}