< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Security.CommunicationObjectSecurityTokenAuthenticator
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/WrapperSecurityCommunicationObject.cs
Line coverage
14%
Covered lines: 5
Uncovered lines: 29
Coverable lines: 34
Total lines: 176
Line coverage: 14.7%
Branch coverage
N/A
Covered branches: 0
Total branches: 0
Branch coverage: N/A
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%11100%
add_Closed(...)100%110%
remove_Closed(...)100%110%
add_Closing(...)100%110%
remove_Closing(...)100%110%
add_Faulted(...)100%110%
remove_Faulted(...)100%110%
add_Opened(...)100%110%
remove_Opened(...)100%110%
add_Opening(...)100%110%
remove_Opening(...)100%110%
Abort()100%110%
OnClose(...)100%110%
OnCloseAsync(...)100%110%
OnFaulted()100%110%
OnOpen(...)100%110%
OnOpenAsync(...)100%110%
CloseAsync()100%110%
CloseAsync(...)100%110%
OpenAsync()100%11100%
OpenAsync(...)100%110%
OnAbort()100%110%
OnClosed()100%110%
OnClosing()100%110%
OnOpened()100%110%
OnOpening()100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Security/WrapperSecurityCommunicationObject.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.IdentityModel.Selectors;
 9
 10namespace CoreWCF.Security
 11{
 12    internal class WrapperSecurityCommunicationObject : CommunicationObject
 13    {
 14        private readonly ISecurityCommunicationObject _innerCommunicationObject;
 15
 16        public WrapperSecurityCommunicationObject(ISecurityCommunicationObject innerCommunicationObject) : base()
 17        {
 18            _innerCommunicationObject = innerCommunicationObject ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelper
 19        }
 20
 21        protected override Type GetCommunicationObjectType()
 22        {
 23            return _innerCommunicationObject.GetType();
 24        }
 25
 26        protected override TimeSpan DefaultCloseTimeout => _innerCommunicationObject.DefaultCloseTimeout;
 27
 28        protected override TimeSpan DefaultOpenTimeout => _innerCommunicationObject.DefaultOpenTimeout;
 29
 30        protected override void OnAbort()
 31        {
 32            _innerCommunicationObject.OnAbort();
 33        }
 34
 35        protected override void OnFaulted()
 36        {
 37            _innerCommunicationObject.OnFaulted();
 38            base.OnFaulted();
 39        }
 40
 41        internal new void ThrowIfDisposedOrImmutable()
 42        {
 43            base.ThrowIfDisposedOrImmutable();
 44        }
 45
 46        protected override Task OnCloseAsync(CancellationToken token)
 47        {
 48            return _innerCommunicationObject.OnCloseAsync(DefaultCloseTimeout);
 49        }
 50
 51        protected override Task OnOpenAsync(CancellationToken token)
 52        {
 53            return _innerCommunicationObject.OnOpenAsync(DefaultOpenTimeout);
 54        }
 55    }
 56
 57    internal abstract class CommunicationObjectSecurityTokenAuthenticator : SecurityTokenAuthenticator, ICommunicationOb
 58    {
 2359        protected CommunicationObjectSecurityTokenAuthenticator()
 60        {
 2361            CommunicationObject = new WrapperSecurityCommunicationObject(this);
 2362        }
 63
 30564        protected WrapperSecurityCommunicationObject CommunicationObject { get; }
 65
 66        public event EventHandler Closed
 67        {
 068            add { CommunicationObject.Closed += value; }
 069            remove { CommunicationObject.Closed -= value; }
 70        }
 71
 72        public event EventHandler Closing
 73        {
 074            add { CommunicationObject.Closing += value; }
 075            remove { CommunicationObject.Closing -= value; }
 76        }
 77
 78        public event EventHandler Faulted
 79        {
 080            add { CommunicationObject.Faulted += value; }
 081            remove { CommunicationObject.Faulted -= value; }
 82        }
 83
 84        public event EventHandler Opened
 85        {
 086            add { CommunicationObject.Opened += value; }
 087            remove { CommunicationObject.Opened -= value; }
 88        }
 89
 90        public event EventHandler Opening
 91        {
 092            add { CommunicationObject.Opening += value; }
 093            remove { CommunicationObject.Opening -= value; }
 94        }
 95
 096        public CommunicationState State => CommunicationObject.State;
 97
 098        public virtual TimeSpan DefaultOpenTimeout => ServiceDefaults.OpenTimeout;
 99
 0100        public virtual TimeSpan DefaultCloseTimeout => ServiceDefaults.CloseTimeout;
 101
 102        // communication object
 103        public void Abort()
 104        {
 0105            CommunicationObject.Abort();
 0106        }
 107
 108
 109        public virtual void OnClose(TimeSpan timeout)
 110        {
 0111        }
 112
 113        public Task OnCloseAsync(TimeSpan timeout)
 114        {
 0115            return Task.CompletedTask;
 116        }
 117
 118        public virtual void OnFaulted()
 119        {
 0120            Abort();
 0121        }
 122
 123        public virtual void OnOpen(TimeSpan timeout)
 124        {
 0125        }
 126
 127        public Task OnOpenAsync(TimeSpan timeout)
 128        {
 0129            return Task.CompletedTask;
 130        }
 131
 132        public virtual Task CloseAsync()
 133        {
 0134            return Task.CompletedTask;
 135        }
 136
 137        public virtual Task CloseAsync(CancellationToken token)
 138        {
 0139            return Task.CompletedTask;
 140        }
 141
 142        public virtual Task OpenAsync()
 143        {
 23144            return Task.CompletedTask;
 145        }
 146
 147        public virtual Task OpenAsync(CancellationToken token)
 148        {
 0149            return Task.CompletedTask;
 150        }
 151
 152        public virtual void OnAbort()
 153        {
 0154        }
 155
 156        public void OnClosed()
 157        {
 0158            throw new NotImplementedException();
 159        }
 160
 161        public void OnClosing()
 162        {
 0163            throw new NotImplementedException();
 164        }
 165
 166        public void OnOpened()
 167        {
 0168            throw new NotImplementedException();
 169        }
 170
 171        public void OnOpening()
 172        {
 0173            throw new NotImplementedException();
 174        }
 175    }
 176}