< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.MsmqBindingElementBase
Assembly: CoreWCF.MSMQ
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.MSMQ/src/CoreWCF/Channels/MsmqBindingElementBase.cs
Line coverage
0%
Covered lines: 0
Uncovered lines: 45
Coverable lines: 45
Total lines: 165
Line coverage: 0%
Branch coverage
0%
Covered branches: 0
Total branches: 10
Branch coverage: 0%
Method coverage

Feature is only available for sponsors

Upgrade to PRO version

Metrics

MethodBranch coverage Cyclomatic complexity NPath complexity Sequence coverage
.ctor()100%110%
.ctor(...)100%110%
GetProperty(...)0%440%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.MSMQ/src/CoreWCF/Channels/MsmqBindingElementBase.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 CoreWCF.Queue.Common.Configuration;
 6using CoreWCF.Runtime;
 7
 8namespace CoreWCF.Channels
 9{
 10    public abstract class MsmqBindingElementBase : QueueBaseTransportBindingElement
 11    {
 12        private DeadLetterQueue _deadLetterQueue;
 13        private int _maxRetryCycles;
 14        private int _receiveRetryCount;
 15        private TimeSpan _retryCycleDelay;
 16        private TimeSpan _timeToLive;
 17
 18        //private ReceiveErrorHandling receiveErrorHandling;
 19
 020        public Uri CustomDeadLetterQueue { get; set; }
 21
 22        public DeadLetterQueue DeadLetterQueue
 23        {
 024            get { return _deadLetterQueue; }
 25            set
 26            {
 027                if (!DeadLetterQueueHelper.IsDefined(value))
 28                {
 029                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(val
 30                }
 31
 032                _deadLetterQueue = value;
 033            }
 34        }
 35
 036        public bool ExactlyOnce { get; set; }
 37
 38        // todo: need to be enabled when we add System.Transactions support
 39        //public int ReceiveRetryCount
 40        //{
 41        //    get { return _receiveRetryCount; }
 42        //    set
 43        //    {
 44        //        if (value < 0)
 45        //        {
 46        //            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
 47        //                new ArgumentOutOfRangeException(nameof(value), value, "MsmqNonNegativeArgumentExpected"));
 48        //        }
 49
 50        //        _receiveRetryCount = value;
 51        //    }
 52        //}
 53
 54        // todo: need to be enabled when we add System.Transactions support
 55        //public int MaxRetryCycles
 56        //{
 57        //    get { return _maxRetryCycles; }
 58        //    set
 59        //    {
 60        //        if (value < 0)
 61        //        {
 62        //            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
 63        //                new ArgumentOutOfRangeException(nameof(value), value, "MsmqNonNegativeArgumentExpected"));
 64        //        }
 65
 66        //        _maxRetryCycles = value;
 67        //    }
 68        //}
 69
 070        public MsmqTransportSecurity MsmqTransportSecurity { get; internal set; }
 71
 072        public bool ReceiveContextEnabled { get; set; }
 73
 74        ///// <summary>Gets or sets an enumeration value that specifies how poison and other messages that cannot be dis
 75        ///// <returns>A <see cref="T:System.ServiceModel.ReceiveErrorHandling" /> value that specifies how poison and o
 76        ///// <exception cref="T:System.ArgumentOutOfRangeException">The value is not within the range of values defined
 77        //public ReceiveErrorHandling ReceiveErrorHandling
 78        //{
 79        //    get
 80        //    {
 81        //        return receiveErrorHandling;
 82        //    }
 83        //    set
 84        //    {
 85        //        if (!ReceiveErrorHandlingHelper.IsDefined(value))
 86        //        {
 87        //            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException(nameof(v
 88        //        }
 89        //        receiveErrorHandling = value;
 90        //    }
 91        //}
 92
 93
 94        public TimeSpan RetryCycleDelay
 95        {
 096            get { return _retryCycleDelay; }
 97            set
 98            {
 099                if (value < TimeSpan.Zero)
 100                {
 0101                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException());
 102                }
 103
 0104                if (TimeoutHelper.IsTooLarge(value))
 105                {
 0106                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException());
 107                }
 108
 0109                _retryCycleDelay = value;
 0110            }
 111        }
 112
 0113        public bool UseSourceJournal { get; set; }
 114
 115        //internal virtual string WsdlTransportUri => null;
 116
 0117        internal MsmqBindingElementBase()
 118        {
 0119            CustomDeadLetterQueue = null;
 0120            _deadLetterQueue = DeadLetterQueue.System;
 0121            ExactlyOnce = true;
 0122            _maxRetryCycles = 2;
 0123            ReceiveContextEnabled = true;
 124            //receiveErrorHandling = ReceiveErrorHandling.Fault;
 0125            _receiveRetryCount = 5;
 0126            _retryCycleDelay = MsmqDefaults.RetryCycleDelay;
 0127            _timeToLive = MsmqDefaults.TimeToLive;
 0128            MsmqTransportSecurity = new MsmqTransportSecurity();
 0129            UseSourceJournal = false;
 130            //ReceiveContextSettings = new MsmqReceiveContextSettings();
 0131        }
 132
 133        internal MsmqBindingElementBase(MsmqBindingElementBase elementToBeCloned)
 0134            : base(elementToBeCloned)
 135        {
 0136            CustomDeadLetterQueue = elementToBeCloned.CustomDeadLetterQueue;
 0137            _deadLetterQueue = elementToBeCloned._deadLetterQueue;
 0138            ExactlyOnce = elementToBeCloned.ExactlyOnce;
 0139            _maxRetryCycles = elementToBeCloned._maxRetryCycles;
 140            //msmqTransportSecurity = new MsmqTransportSecurity(elementToBeCloned.MsmqTransportSecurity);
 0141            ReceiveContextEnabled = elementToBeCloned.ReceiveContextEnabled;
 142            //receiveErrorHandling = elementToBeCloned.receiveErrorHandling;
 0143            _receiveRetryCount = elementToBeCloned._receiveRetryCount;
 0144            _retryCycleDelay = elementToBeCloned._retryCycleDelay;
 0145            _timeToLive = elementToBeCloned._timeToLive;
 0146            UseSourceJournal = elementToBeCloned.UseSourceJournal;
 147            //ReceiveContextSettings = elementToBeCloned.ReceiveContextSettings;
 0148        }
 149
 150        public override T GetProperty<T>(BindingContext context)
 151        {
 0152            if (context == null)
 153            {
 0154                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(context));
 155            }
 156
 0157            if (typeof(T) == typeof(ISecurityCapabilities))
 158            {
 0159                return null;
 160            }
 161
 0162            return base.GetProperty<T>(context);
 163        }
 164    }
 165}