< Summary - CoreWCF Coverage — PR #1766

Information
Class: CoreWCF.Channels.Configuration.RabbitMqQueueXArgument
Assembly: CoreWCF.RabbitMQ
File(s): /home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.RabbitMQ/src/CoreWCF/Channels/Configuration/QueueDeclareConfiguration.cs
Line coverage
100%
Covered lines: 3
Uncovered lines: 0
Coverable lines: 3
Total lines: 99
Line coverage: 100%
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
.cctor()100%11100%

File(s)

/home/runner/work/CoreWCF/CoreWCF/src/CoreWCF.RabbitMQ/src/CoreWCF/Channels/Configuration/QueueDeclareConfiguration.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;
 6
 7namespace CoreWCF.Channels.Configuration
 8{
 9    public static class RabbitMqQueueType
 10    {
 11        public static readonly string Classic = "classic";
 12        public static readonly string Quorum = "quorum";
 13    }
 14
 15    public static class RabbitMqQueueXArgument
 16    {
 117        public static readonly string QueueType = "x-queue-type";
 118        public static readonly string Priority = "x-max-priority";
 119        public static readonly string DeadLetterExchange = "x-dead-letter-exchange ";
 20    }
 21
 22    public abstract class QueueDeclareConfiguration
 23    {
 24        /// <summary>
 25        /// Declares the type of queue to be created
 26        /// </summary>
 27        public abstract string QueueType { get; }
 28
 29        /// <summary>
 30        /// If non-zero, the queue will behave as a priority queue, where the value of Priority is the max priority valu
 31        /// </summary>
 32        public virtual byte Priority { get; set; } = 0;
 33
 34        /// <summary>
 35        /// If a message is dead-lettered, it will be republished to this exchange
 36        /// </summary>
 37        public virtual string DeadLetterExchange { get; set; } = "dead-letter-exchange";
 38
 39        /// <summary>
 40        /// If true, the queue will survive a broker restart.
 41        /// </summary>
 42        public virtual bool Durable { get; set; } = true;
 43
 44        /// <summary>
 45        /// If true, the queue will be limited to its declaring connection and deleted when its declaring connection clo
 46        /// </summary>
 47        public virtual bool Exclusive { get; set; } = false;
 48
 49        /// <summary>
 50        /// If true, the queue will be auto-deleted when its last consumer (if any) unsubscribes.
 51        /// </summary>
 52        public virtual bool AutoDelete { get; set; } = false;
 53
 54        /// <summary>
 55        /// Sets number of messages to receive from queue
 56        /// </summary>
 57        private ushort _prefetchCount = 1;
 58        public virtual ushort PrefetchCount
 59        {
 60            get
 61            {
 62                return _prefetchCount;
 63            }
 64            set
 65            {
 66                if (value < 1)
 67                {
 68                    throw new ArgumentOutOfRangeException(SR.Format(SR.InvalidRabbitMqPrefetchCountValue, value));
 69                }
 70                _prefetchCount = value;
 71            }
 72        }
 73
 74        /// <summary>
 75        /// If true, PrefetchCount is shared by all consumers. If false, the PrefetchCount is per channel/consumer.
 76        /// </summary>
 77        public virtual bool GlobalQosPrefetch { get; set; } = false;
 78
 79        /// <summary>
 80        /// Creates a dictionary of x-arguments used to define a RabbitMQ queue.
 81        /// </summary>
 82        /// <returns>A dictionary of x-arguments and their values</returns>
 83        internal virtual Dictionary<string, object> ToDictionary()
 84        {
 85            var propertiesDict = new Dictionary<string, object>
 86            {
 87                { RabbitMqQueueXArgument.QueueType, QueueType },
 88                { RabbitMqQueueXArgument.DeadLetterExchange, DeadLetterExchange }
 89            };
 90
 91            if (Priority > 0)
 92            {
 93                propertiesDict[RabbitMqQueueXArgument.Priority] = Priority;
 94            }
 95
 96            return propertiesDict;
 97        }
 98    }
 99}

Methods/Properties

.cctor()