< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Dispatcher.SharedRuntimeState
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Dispatcher/SharedRuntimeState.cs
Line coverage
78%
Covered lines: 11
Uncovered lines: 3
Coverable lines: 14
Total lines: 43
Line coverage: 78.5%
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
.ctor(...)100%11100%
LockDownProperties()100%11100%
ThrowIfImmutable()25%4440%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Dispatcher/SharedRuntimeState.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.Dispatcher
 7{
 8    internal class SharedRuntimeState
 9    {
 10        private bool _isImmutable;
 11
 132712        internal SharedRuntimeState(bool isOnServer)
 13        {
 132714            IsOnServer = isOnServer;
 132715        }
 16
 264817        internal bool EnableFaults { get; set; } = true;
 18
 198519        internal bool IsOnServer { get; }
 20
 364421        internal bool ManualAddressing { get; set; }
 22
 263023        internal bool ValidateMustUnderstand { get; set; } = true;
 24
 25        internal void LockDownProperties()
 26        {
 66127            _isImmutable = true;
 66128        }
 29
 30        internal void ThrowIfImmutable()
 31        {
 4149132            if (_isImmutable)
 33            {
 034                if (IsOnServer)
 35                {
 036                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.SFxImmuta
 37                }
 38
 039                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.SFxImmutableC
 40            }
 4149141        }
 42    }
 43}