< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.OperationContractAttribute
Assembly: CoreWCF.Primitives
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/OperationContractAttribute.cs
Line coverage
85%
Covered lines: 17
Uncovered lines: 3
Coverable lines: 20
Total lines: 87
Line coverage: 85%
Branch coverage
75%
Covered branches: 6
Total branches: 8
Branch coverage: 75%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
EnsureInvariants(...)100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.Primitives/src/CoreWCF/OperationContractAttribute.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.Reflection;
 6using CoreWCF.Description;
 7
 8namespace CoreWCF
 9{
 10    [AttributeUsage(CoreWCFAttributeTargets.OperationContract)]
 11    public sealed class OperationContractAttribute : Attribute
 12    {
 13        private string _name;
 14        private string _action;
 15        private string _replyAction;
 16
 17        public string Name
 18        {
 268619            get { return _name; }
 20            set
 21            {
 779022                if (value == null)
 23                {
 024                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(value));
 25                }
 779026                if (value == "")
 27                {
 028                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 029                        SR.SFxNameCannotBeEmpty));
 30                }
 31
 779032                _name = value;
 779033            }
 34        }
 35
 36        internal const string ActionPropertyName = "Action";
 37        public string Action
 38        {
 537239            get { return _action; }
 40            set
 41            {
 758142                _action = value ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(value));
 758043            }
 44        }
 45
 46        internal const string ReplyActionPropertyName = "ReplyAction";
 47        public string ReplyAction
 48        {
 301249            get { return _replyAction; }
 50            set
 51            {
 771452                _replyAction = value ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(value));
 771353            }
 54        }
 55
 264156        public bool AsyncPattern { get; set; }
 57
 1102958        public bool IsOneWay { get; set; }
 59
 2042060        public bool IsInitiating { get; set; } = true;
 61
 296162        public bool IsTerminating { get; set; }
 63
 64        internal bool IsSessionOpenNotificationEnabled
 65        {
 66            get
 67            {
 268668                return Action == OperationDescription.SessionOpenedAction;
 69            }
 70        }
 71
 72        internal void EnsureInvariants(MethodInfo methodInfo, string operationName)
 73        {
 74            // This code is used for WebSockets open notification
 75            //if (IsSessionOpenNotificationEnabled)
 76            //{
 77            //    if (!IsOneWay
 78            //     || !this.IsInitiating
 79            //     || methodInfo.GetParameters().Length > 0)
 80            //    {
 81            //        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(
 82            //            SR.Format(SR.ContractIsNotSelfConsistentWhenIsSessionOpenNotificationEnabled, operationName, "
 83            //    }
 84            //}
 268685        }
 86    }
 87}