< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Dispatcher.ClientOperation
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Dispatcher/ClientOperation.cs
Line coverage
89%
Covered lines: 90
Uncovered lines: 11
Coverable lines: 101
Total lines: 240
Line coverage: 89.1%
Branch coverage
66%
Covered branches: 4
Total branches: 6
Branch coverage: 66.6%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor(...)50%44100%
.ctor(...)100%110%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/Dispatcher/ClientOperation.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.Reflection;
 7using CoreWCF.Collections.Generic;
 8
 9namespace CoreWCF.Dispatcher
 10{
 11    public sealed class ClientOperation
 12    {
 13        private bool _serializeRequest;
 14        private bool _deserializeReply;
 15        private IClientFaultFormatter _faultFormatter;
 50716        private bool _isInitiating = true;
 17        private bool _isOneWay;
 18        private bool _isTerminating;
 19        private bool _isSessionOpenNotificationEnabled;
 20        private MethodInfo _beginMethod;
 21        private MethodInfo _endMethod;
 22        private MethodInfo _syncMethod;
 23        private MethodInfo _taskMethod;
 24        private Type _taskTResult;
 25
 26        public ClientOperation(ClientRuntime parent, string name, string action)
 027            : this(parent, name, action, null)
 28        {
 029        }
 30
 50731        public ClientOperation(ClientRuntime parent, string name, string action, string replyAction)
 32        {
 50733            Parent = parent ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(parent));
 50734            Name = name ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(name));
 50735            Action = action;
 50736            ReplyAction = replyAction;
 37
 50738            FaultContractInfos = parent.NewBehaviorCollection<FaultContractInfo>();
 50739            ParameterInspectors = parent.NewBehaviorCollection<IParameterInspector>();
 50740        }
 41
 342        public string Action { get; }
 43
 244        internal SynchronizedCollection<FaultContractInfo> FaultContractInfos { get; }
 45
 46        public MethodInfo BeginMethod
 47        {
 248            get { return _beginMethod; }
 49            set
 50            {
 251                lock (Parent.ThisLock)
 52                {
 253                    Parent.InvalidateRuntime();
 254                    _beginMethod = value;
 255                }
 256            }
 57        }
 58
 59        public MethodInfo EndMethod
 60        {
 061            get { return _endMethod; }
 62            set
 63            {
 264                lock (Parent.ThisLock)
 65                {
 266                    Parent.InvalidateRuntime();
 267                    _endMethod = value;
 268                }
 269            }
 70        }
 71
 72        public MethodInfo SyncMethod
 73        {
 274            get { return _syncMethod; }
 75            set
 76            {
 277                lock (Parent.ThisLock)
 78                {
 279                    Parent.InvalidateRuntime();
 280                    _syncMethod = value;
 281                }
 282            }
 83        }
 84
 85        public IClientMessageFormatter Formatter
 86        {
 487            get { return InternalFormatter; }
 88            set
 89            {
 290                lock (Parent.ThisLock)
 91                {
 292                    Parent.InvalidateRuntime();
 293                    InternalFormatter = value;
 294                }
 295            }
 96        }
 97
 98        internal IClientFaultFormatter FaultFormatter
 99        {
 100            get
 101            {
 2102                if (_faultFormatter == null)
 103                {
 2104                    _faultFormatter = new DataContractSerializerFaultFormatter(FaultContractInfos);
 105                }
 2106                return _faultFormatter;
 107            }
 108            set
 109            {
 0110                lock (Parent.ThisLock)
 111                {
 0112                    Parent.InvalidateRuntime();
 0113                    _faultFormatter = value;
 0114                    IsFaultFormatterSetExplicit = true;
 0115                }
 0116            }
 117        }
 118
 0119        internal bool IsFaultFormatterSetExplicit { get; private set; } = false;
 120
 511121        internal IClientMessageFormatter InternalFormatter { get; set; }
 122
 123        public bool IsInitiating
 124        {
 2125            get { return _isInitiating; }
 126            set
 127            {
 2128                lock (Parent.ThisLock)
 129                {
 2130                    Parent.InvalidateRuntime();
 2131                    _isInitiating = value;
 2132                }
 2133            }
 134        }
 135
 136        public bool IsOneWay
 137        {
 2138            get { return _isOneWay; }
 139            set
 140            {
 2141                lock (Parent.ThisLock)
 142                {
 2143                    Parent.InvalidateRuntime();
 2144                    _isOneWay = value;
 2145                }
 2146            }
 147        }
 148
 149        public bool IsTerminating
 150        {
 2151            get { return _isTerminating; }
 152            set
 153            {
 2154                lock (Parent.ThisLock)
 155                {
 2156                    Parent.InvalidateRuntime();
 2157                    _isTerminating = value;
 2158                }
 2159            }
 160        }
 161
 8162        public string Name { get; }
 163
 164        public ICollection<IParameterInspector> ClientParameterInspectors
 165        {
 0166            get { return ParameterInspectors; }
 167        }
 168
 3169        internal SynchronizedCollection<IParameterInspector> ParameterInspectors { get; }
 170
 50171        public ClientRuntime Parent { get; }
 172
 2173        public string ReplyAction { get; }
 174
 175        public bool SerializeRequest
 176        {
 2177            get { return _serializeRequest; }
 178            set
 179            {
 2180                lock (Parent.ThisLock)
 181                {
 2182                    Parent.InvalidateRuntime();
 2183                    _serializeRequest = value;
 2184                }
 2185            }
 186        }
 187
 188        public bool DeserializeReply
 189        {
 2190            get { return _deserializeReply; }
 191            set
 192            {
 2193                lock (Parent.ThisLock)
 194                {
 2195                    Parent.InvalidateRuntime();
 2196                    _deserializeReply = value;
 2197                }
 2198            }
 199        }
 200
 201        public MethodInfo TaskMethod
 202        {
 2203            get { return _taskMethod; }
 204            set
 205            {
 2206                lock (Parent.ThisLock)
 207                {
 2208                    Parent.InvalidateRuntime();
 2209                    _taskMethod = value;
 2210                }
 2211            }
 212        }
 213
 214        public Type TaskTResult
 215        {
 2216            get { return _taskTResult; }
 217            set
 218            {
 2219                lock (Parent.ThisLock)
 220                {
 2221                    Parent.InvalidateRuntime();
 2222                    _taskTResult = value;
 2223                }
 2224            }
 225        }
 226
 227        internal bool IsSessionOpenNotificationEnabled
 228        {
 2229            get { return _isSessionOpenNotificationEnabled; }
 230            set
 231            {
 2232                lock (Parent.ThisLock)
 233                {
 2234                    Parent.InvalidateRuntime();
 2235                    _isSessionOpenNotificationEnabled = value;
 2236                }
 2237            }
 238        }
 239    }
 240}