< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.WindowsServiceCredential
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/WindowsServiceCredential.cs
Line coverage
66%
Covered lines: 18
Uncovered lines: 9
Coverable lines: 27
Total lines: 82
Line coverage: 66.6%
Branch coverage
50%
Covered branches: 1
Total branches: 2
Branch coverage: 50%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%
.ctor(...)100%11100%
MakeReadOnly()100%110%
ThrowIfImmutable()50%2266.66%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/WindowsServiceCredential.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    public sealed class WindowsServiceCredential
 9    {
 10        private bool _allowAnonymousLogons = SspiSecurityTokenProvider.DefaultAllowUnauthenticatedCallers;
 11811        private bool _includeWindowsGroups = SspiSecurityTokenProvider.DefaultExtractWindowsGroupClaims;
 12        private bool _isReadOnly;
 13        private LdapSettings _ldapSettings;
 14
 5215        internal WindowsServiceCredential()
 16        {
 17            // empty
 5218        }
 19
 6620        internal WindowsServiceCredential(WindowsServiceCredential other)
 21        {
 6622            _allowAnonymousLogons = other._allowAnonymousLogons;
 6623            _includeWindowsGroups = other._includeWindowsGroups;
 6624            _isReadOnly = other._isReadOnly;
 6625            _ldapSettings = other._ldapSettings;
 6626        }
 27
 28        public bool AllowAnonymousLogons
 29        {
 30            get
 31            {
 1332                return _allowAnonymousLogons;
 33            }
 34            set
 35            {
 036                ThrowIfImmutable();
 037                _allowAnonymousLogons = value;
 038            }
 39        }
 40
 41        public bool IncludeWindowsGroups
 42        {
 43            get
 44            {
 1345                return _includeWindowsGroups;
 46            }
 47            set
 48            {
 049                ThrowIfImmutable();
 050                _includeWindowsGroups = value;
 051            }
 52        }
 53
 54        public LdapSettings LdapSetting
 55        {
 56            get
 57            {
 1358                return _ldapSettings;
 59            }
 60            set
 61            {
 962                ThrowIfImmutable();
 963                value.Validate();
 964                _ldapSettings = value;
 965            }
 66        }
 67
 68
 69        internal void MakeReadOnly()
 70        {
 071            _isReadOnly = true;
 072        }
 73
 74        private void ThrowIfImmutable()
 75        {
 976            if (_isReadOnly)
 77            {
 078                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.ObjectIsReadO
 79            }
 980        }
 81    }
 82}