< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Dispatcher.ServiceDispatcher
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Dispatcher/ServiceDispatcher.cs
Line coverage
100%
Covered lines: 31
Uncovered lines: 0
Coverable lines: 31
Total lines: 71
Line coverage: 100%
Branch coverage
100%
Covered branches: 6
Total branches: 6
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%
CreateServiceChannelDispatcherAsync()66.66%6680%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Dispatcher/ServiceDispatcher.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.Generic;
 6using System.Threading.Tasks;
 7using CoreWCF.Channels;
 8using CoreWCF.Configuration;
 9using CoreWCF.Runtime;
 10
 11namespace CoreWCF.Dispatcher
 12{
 13    internal class ServiceDispatcher : IServiceDispatcher
 14    {
 15        private readonly IRequestReplyCorrelator _requestReplyCorrelator;
 16
 66017        public ServiceDispatcher(ChannelDispatcher channelDispatcher)
 18        {
 66019            ChannelDispatcher = channelDispatcher;
 20            // TODO: Maybe make lazy
 66021            _requestReplyCorrelator = new RequestReplyCorrelator();
 66022        }
 23
 996124        public Uri BaseAddress => ChannelDispatcher.ListenUri;
 25
 859926        public Binding Binding => ChannelDispatcher.Binding;
 27
 2744428        public ChannelDispatcher ChannelDispatcher { get; }
 29
 6930        public ServiceHostBase Host { get { return ChannelDispatcher.Host; } }
 31
 251832        public EndpointDispatcherTable Endpoints => ChannelDispatcher.EndpointDispatcherTable;
 33
 45934        public IList<Type> SupportedChannelTypes => ChannelDispatcher.SupportedChannelTypes;
 35
 109336        public AsyncLock ThisLock { get; } = new AsyncLock();
 37
 38        public async Task<IServiceChannelDispatcher> CreateServiceChannelDispatcherAsync(IChannel channel)
 39        {
 231840            ServiceChannel.SessionIdleManager sessionIdleManager = channel.GetProperty<ServiceChannel.SessionIdleManager
 231841            IChannelBinder binder = null;
 231842            if (channel is IReplyChannel)
 43            {
 52544                ReplyChannelBinder rcbinder = channel.GetProperty<ReplyChannelBinder>();
 52545                rcbinder.Init(channel as IReplyChannel, BaseAddress);
 52546                binder = rcbinder;
 47            }
 179348            else if (channel is IDuplexSessionChannel)
 49            {
 7550                DuplexChannelBinder dcbinder = channel.GetProperty<DuplexChannelBinder>();
 7551                dcbinder.Init(channel as IDuplexSessionChannel, _requestReplyCorrelator, BaseAddress);
 7552                binder = dcbinder;
 53            }
 171854            else if (channel is IInputChannel)
 55            {
 171856                InputChannelBinder icbinder = channel.GetProperty<InputChannelBinder>();
 171857                icbinder.Init(channel as IInputChannel, BaseAddress);
 171858                binder = icbinder;
 59            }
 60
 61            // TODO: Wire up wasChannelThrottled
 231862            var channelHandler = new ChannelHandler(Binding.MessageVersion, binder, channel.GetProperty<ServiceThrottle>
 231863             this, /*wasChannelThrottled*/ false, sessionIdleManager);
 64
 231865            IServiceChannelDispatcher channelDispatcher = channelHandler.GetDispatcher();
 66            //   channel.ChannelDispatcher = channelDispatcher;
 231867            await channelHandler.OpenAsync();
 231868            return channelDispatcher;
 231869        }
 70    }
 71}