< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Dispatcher.ReplyChannelBinder
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Dispatcher/ReplyChannelBinder.cs
Line coverage
53%
Covered lines: 14
Uncovered lines: 12
Coverable lines: 26
Total lines: 108
Line coverage: 53.8%
Branch coverage
75%
Covered branches: 3
Total branches: 4
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%
Init(...)75%4487.5%
Abort()100%110%
CloseAfterFault(...)100%110%
CreateRequestContext(...)100%110%
SendAsync(...)100%110%
RequestAsync(...)100%110%
SetNextDispatcher(...)100%11100%
DispatchAsync(...)100%11100%
DispatchAsync(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Dispatcher/ReplyChannelBinder.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.Threading;
 6using System.Threading.Tasks;
 7using CoreWCF.Channels;
 8using CoreWCF.Configuration;
 9using CoreWCF.Diagnostics;
 10using CoreWCF.Runtime;
 11
 12namespace CoreWCF.Dispatcher
 13{
 14    internal class ReplyChannelBinder : IChannelBinder
 15    {
 16        private IReplyChannel _channel;
 17        private bool _initialized = false;
 18        private IServiceChannelDispatcher _next;
 19
 99820        public ReplyChannelBinder() { }
 21
 22        internal void Init(IReplyChannel channel, Uri listenUri)
 23        {
 52524            if (_initialized)
 25            {
 26                Fx.Assert(_channel == channel, "Wrong channel when calling Init");
 27                Fx.Assert(ListenUri == listenUri, "Wrong listenUri when calling Init");
 2628                return;
 29            }
 30
 49931            if (channel == null)
 32            {
 33                Fx.Assert("ReplyChannelBinder.ReplyChannelBinder: (channel != null)");
 034                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(channel));
 35            }
 49936            _channel = channel;
 49937            ListenUri = listenUri;
 49938            _initialized = true;
 49939        }
 40
 41        public IChannel Channel
 42        {
 346443            get { return _channel; }
 44        }
 45
 46        public bool HasSession
 47        {
 184648            get { return _channel is ISessionChannel<IInputSession>; }
 49        }
 50
 49951        public Uri ListenUri { get; private set; }
 52
 53        public EndpointAddress LocalAddress
 54        {
 055            get { return _channel.LocalAddress; }
 56        }
 57
 58        public EndpointAddress RemoteAddress
 59        {
 60            get
 61            {
 062                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
 63            }
 64        }
 65
 66        public void Abort()
 67        {
 068            _channel.Abort();
 069        }
 70
 71        public void CloseAfterFault(TimeSpan timeout)
 72        {
 073            var helper = new TimeoutHelper(timeout);
 074            _channel.CloseAsync(helper.GetCancellationToken()).GetAwaiter().GetResult();
 075        }
 76
 77        public RequestContext CreateRequestContext(Message message)
 78        {
 079            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
 80        }
 81
 82        public Task SendAsync(Message message, CancellationToken token)
 83        {
 084            throw TraceUtility.ThrowHelperError(new NotImplementedException(), message);
 85        }
 86
 87        public Task<Message> RequestAsync(Message message, CancellationToken token)
 88        {
 089            throw TraceUtility.ThrowHelperError(new NotImplementedException(), message);
 90        }
 91
 92        public void SetNextDispatcher(IServiceChannelDispatcher dispatcher)
 93        {
 52594            _next = dispatcher;
 52595        }
 96
 97        public Task DispatchAsync(RequestContext context)
 98        {
 99            Fx.Assert(_next != null, "SetNextDispatcher wasn't called");
 810100            return _next.DispatchAsync(context);
 101        }
 102
 103        public Task DispatchAsync(Message message)
 104        {
 0105            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException());
 106        }
 107    }
 108}