< Summary

Class:Azure.Messaging.ServiceBus.Amqp.Framing.AmqpCorrelationRuleFilterCodec
Assembly:Azure.Messaging.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Amqp\Framing\AmqpCorrelationRuleFilterCodec.cs
Covered lines:0
Uncovered lines:56
Coverable lines:56
Total lines:125
Line coverage:0% (0 of 56)
Covered branches:0
Total branches:18
Branch coverage:0% (0 of 18)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
get_CorrelationId()-0%100%
get_MessageId()-0%100%
get_To()-0%100%
get_ReplyTo()-0%100%
get_Label()-0%100%
get_SessionId()-0%100%
get_ReplyToSessionId()-0%100%
get_ContentType()-0%100%
get_Properties()-0%100%
get_FieldCount()-0%100%
ToString()-0%100%
OnEncode(...)-0%100%
OnDecode(...)-0%0%
OnValueSize()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\servicebus\Azure.Messaging.ServiceBus\src\Amqp\Framing\AmqpCorrelationRuleFilterCodec.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System.Text;
 5using Microsoft.Azure.Amqp;
 6using Microsoft.Azure.Amqp.Encoding;
 7
 8namespace Azure.Messaging.ServiceBus.Amqp.Framing
 9{
 10    internal sealed class AmqpCorrelationRuleFilterCodec : AmqpRuleFilterCodec
 11    {
 12        public const string Name = AmqpConstants.Vendor + ":correlation-filter:list";
 13        public const ulong Code = 0x000001370000009;
 14        private const int Fields = 9;
 15        private AmqpMap properties;
 16
 017        public AmqpCorrelationRuleFilterCodec() : base(Name, Code)
 18        {
 019            properties = new AmqpMap();
 020        }
 21
 022        public string CorrelationId { get; set; }
 23
 024        public string MessageId { get; set; }
 25
 026        public string To { get; set; }
 27
 028        public string ReplyTo { get; set; }
 29
 030        public string Label { get; set; }
 31
 032        public string SessionId { get; set; }
 33
 034        public string ReplyToSessionId { get; set; }
 35
 036        public string ContentType { get; set; }
 37
 038        public AmqpMap Properties => properties;
 39
 040        protected override int FieldCount => Fields;
 41
 42        public override string ToString()
 43        {
 044            var stringBuilder = new StringBuilder("correlation(");
 045            var count = 0;
 046            AddFieldToString(CorrelationId != null, stringBuilder, "id", CorrelationId, ref count);
 047            stringBuilder.Append(')');
 048            return stringBuilder.ToString();
 49        }
 50
 51        protected override void OnEncode(ByteBuffer buffer)
 52        {
 053            AmqpCodec.EncodeString(CorrelationId, buffer);
 054            AmqpCodec.EncodeString(MessageId, buffer);
 055            AmqpCodec.EncodeString(To, buffer);
 056            AmqpCodec.EncodeString(ReplyTo, buffer);
 057            AmqpCodec.EncodeString(Label, buffer);
 058            AmqpCodec.EncodeString(SessionId, buffer);
 059            AmqpCodec.EncodeString(ReplyToSessionId, buffer);
 060            AmqpCodec.EncodeString(ContentType, buffer);
 061            AmqpCodec.EncodeMap(properties, buffer);
 062        }
 63
 64        protected override void OnDecode(ByteBuffer buffer, int count)
 65        {
 066            if (count-- > 0)
 67            {
 068                CorrelationId = AmqpCodec.DecodeString(buffer);
 69            }
 70
 071            if (count-- > 0)
 72            {
 073                MessageId = AmqpCodec.DecodeString(buffer);
 74            }
 75
 076            if (count-- > 0)
 77            {
 078                To = AmqpCodec.DecodeString(buffer);
 79            }
 80
 081            if (count-- > 0)
 82            {
 083                ReplyTo = AmqpCodec.DecodeString(buffer);
 84            }
 85
 086            if (count-- > 0)
 87            {
 088                Label = AmqpCodec.DecodeString(buffer);
 89            }
 90
 091            if (count-- > 0)
 92            {
 093                SessionId = AmqpCodec.DecodeString(buffer);
 94            }
 95
 096            if (count-- > 0)
 97            {
 098                ReplyToSessionId = AmqpCodec.DecodeString(buffer);
 99            }
 100
 0101            if (count-- > 0)
 102            {
 0103                ContentType = AmqpCodec.DecodeString(buffer);
 104            }
 105
 0106            if (count > 0)
 107            {
 0108                properties = AmqpCodec.DecodeMap(buffer);
 109            }
 0110        }
 111
 112        protected override int OnValueSize()
 113        {
 0114            return AmqpCodec.GetStringEncodeSize(CorrelationId) +
 0115                   AmqpCodec.GetStringEncodeSize(MessageId) +
 0116                   AmqpCodec.GetStringEncodeSize(To) +
 0117                   AmqpCodec.GetStringEncodeSize(ReplyTo) +
 0118                   AmqpCodec.GetStringEncodeSize(Label) +
 0119                   AmqpCodec.GetStringEncodeSize(SessionId) +
 0120                   AmqpCodec.GetStringEncodeSize(ReplyToSessionId) +
 0121                   AmqpCodec.GetStringEncodeSize(ContentType) +
 0122                   AmqpCodec.GetMapEncodeSize(properties);
 123        }
 124    }
 125}