< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Dispatcher.ThreadBehavior
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Dispatcher/ThreadBehavior.cs
Line coverage
100%
Covered lines: 6
Uncovered lines: 0
Coverable lines: 6
Total lines: 30
Line coverage: 100%
Branch coverage
100%
Covered branches: 2
Total branches: 2
Branch coverage: 100%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)100%11100%
GetSyncContext(...)100%22100%
GetCurrentSynchronizationContext()100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Dispatcher/ThreadBehavior.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.Threading;
 5using CoreWCF.Runtime;
 6
 7namespace CoreWCF.Dispatcher
 8{
 9    internal class ThreadBehavior
 10    {
 11        private readonly SynchronizationContext _context;
 12
 66113        internal ThreadBehavior(DispatchRuntime dispatch)
 14        {
 66115            _context = dispatch.SynchronizationContext;
 66116        }
 17
 18        internal SynchronizationContext GetSyncContext(MessageRpc rpc)
 19        {
 20            Fx.Assert(rpc.InstanceContext != null, "instanceContext is null !");
 253621            SynchronizationContext syncContext = rpc.InstanceContext.SynchronizationContext ?? _context;
 253622            return syncContext;
 23        }
 24
 25        internal static SynchronizationContext GetCurrentSynchronizationContext()
 26        {
 66427            return SynchronizationContext.Current;
 28        }
 29    }
 30}