< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.OutputChannel
Assembly: CoreWCF.NetFramingBase
File(s): /home/runner/work/CoreWCF/CoreWCF/src/Common/src/DuplexChannels/CoreWCF/Channels/OutputChannel.cs
Line coverage
73%
Covered lines: 14
Uncovered lines: 5
Coverable lines: 19
Total lines: 70
Line coverage: 73.6%
Branch coverage
50%
Covered branches: 4
Total branches: 8
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%
GetProperty()50%4466.66%
SendAsync(...)100%11100%
SendAsync(...)50%4466.66%
EmitTrace(...)100%11100%
AddHeadersTo(...)100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/Common/src/DuplexChannels/CoreWCF/Channels/OutputChannel.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;
 7
 8namespace CoreWCF.Channels
 9{
 10    internal abstract class OutputChannel : ServiceChannelBase, IOutputChannel
 11    {
 12812        protected OutputChannel(IDefaultCommunicationTimeouts timeouts) : base(timeouts) { }
 13
 14        public abstract EndpointAddress RemoteAddress { get; }
 15
 16        public abstract Uri Via { get; }
 17
 18        public override T GetProperty<T>()
 19        {
 13620            if (typeof(T) == typeof(IOutputChannel))
 21            {
 022                return (T)(object)this;
 23            }
 24
 13625            T baseProperty = base.GetProperty<T>();
 13626            if (baseProperty != null)
 27            {
 028                return baseProperty;
 29            }
 30
 13631            return default;
 32        }
 33
 34        protected abstract Task OnSendAsync(Message message, CancellationToken token);
 35
 36        public Task SendAsync(Message message)
 37        {
 138            return SendAsync(message, CancellationToken.None);
 39        }
 40
 41        public Task SendAsync(Message message, CancellationToken token)
 42        {
 7643            if (message == null)
 44            {
 045                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(message));
 46            }
 47
 48            // TODO: Fix exception message as a negative timeout wasn't passed, a cancelled token was
 7649            if (token.IsCancellationRequested)
 50            {
 051                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
 052                    new ArgumentException(SRCommon.SFxTimeoutOutOfRange0, nameof(token)));
 53            }
 54
 7655            ThrowIfDisposedOrNotOpen();
 56
 7657            AddHeadersTo(message);
 7658            EmitTrace(message);
 7659            return OnSendAsync(message, token);
 60        }
 61
 62        private void EmitTrace(Message message)
 63        {
 7664        }
 65
 66        protected virtual void AddHeadersTo(Message message)
 67        {
 7668        }
 69    }
 70}