< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.SecureConversationServiceCredential
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/SecureConversationServiceCredential.cs
Line coverage
59%
Covered lines: 13
Uncovered lines: 9
Coverable lines: 22
Total lines: 61
Line coverage: 59%
Branch coverage
25%
Covered branches: 1
Total branches: 4
Branch coverage: 25%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.cctor()100%11100%
.ctor()100%11100%
.ctor(...)50%2285.71%
MakeReadOnly()100%110%
ThrowIfImmutable()0%220%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/SecureConversationServiceCredential.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 System.Collections.ObjectModel;
 6
 7namespace CoreWCF.Security
 8{
 9    public sealed class SecureConversationServiceCredential
 10    {
 611        private static readonly SecurityStateEncoder s_defaultSecurityStateEncoder = new DataProtectionSecurityStateEnco
 12        private SecurityStateEncoder _securityStateEncoder;
 13        private bool _isReadOnly;
 14
 5215        internal SecureConversationServiceCredential()
 16        {
 5217            _securityStateEncoder = s_defaultSecurityStateEncoder;
 5218            SecurityContextClaimTypes = new Collection<Type>();
 19            // SamlAssertion.AddSamlClaimTypes(securityContextClaimTypes);
 5220        }
 21
 6622        internal SecureConversationServiceCredential(SecureConversationServiceCredential other)
 23        {
 6624            _securityStateEncoder = other._securityStateEncoder;
 6625            SecurityContextClaimTypes = new Collection<Type>();
 13226            for (int i = 0; i < other.SecurityContextClaimTypes.Count; ++i)
 27            {
 028                SecurityContextClaimTypes.Add(other.SecurityContextClaimTypes[i]);
 29            }
 6630            _isReadOnly = other._isReadOnly;
 6631        }
 32
 33        public SecurityStateEncoder SecurityStateEncoder
 34        {
 35            get
 36            {
 7937                return _securityStateEncoder;
 38            }
 39            set
 40            {
 041                ThrowIfImmutable();
 042                _securityStateEncoder = value;
 043            }
 44        }
 45
 14546        public Collection<Type> SecurityContextClaimTypes { get; }
 47
 48        internal void MakeReadOnly()
 49        {
 050            _isReadOnly = true;
 051        }
 52
 53        private void ThrowIfImmutable()
 54        {
 055            if (_isReadOnly)
 56            {
 057                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.ObjectIsReadO
 58            }
 059        }
 60    }
 61}