< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
get_SqlExpression()-0%100%
set_SqlExpression(...)-0%100%
get_CompatibilityLevel()-0%100%
set_CompatibilityLevel(...)-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\AmqpSqlRuleActionCodec.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;
 6
 7namespace Azure.Messaging.ServiceBus.Amqp.Framing
 8{
 9    internal sealed class AmqpSqlRuleActionCodec : AmqpRuleActionCodec
 10    {
 11        public const string Name = AmqpConstants.Vendor + ":sql-rule-action:list";
 12        public const ulong Code = 0x0000013700000006;
 13        private const int Fields = 2;
 14
 015        public AmqpSqlRuleActionCodec() : base(Name, Code) { }
 16
 17        public string SqlExpression
 18        {
 019            get;
 020            set;
 21        }
 22
 23        public int? CompatibilityLevel
 24        {
 025            get;
 026            set;
 27        }
 28
 029        protected override int FieldCount => Fields;
 30
 31        public override string ToString()
 32        {
 033            var sb = new StringBuilder("sql-rule-action(");
 034            var count = 0;
 035            AddFieldToString(SqlExpression != null, sb, "expression", SqlExpression, ref count);
 036            AddFieldToString(CompatibilityLevel != null, sb, "level", CompatibilityLevel, ref count);
 037            sb.Append(')');
 038            return sb.ToString();
 39        }
 40
 41        protected override void OnEncode(ByteBuffer buffer)
 42        {
 043            AmqpCodec.EncodeString(SqlExpression, buffer);
 044            AmqpCodec.EncodeInt(CompatibilityLevel, buffer);
 045        }
 46
 47        protected override void OnDecode(ByteBuffer buffer, int count)
 48        {
 049            if (count-- > 0)
 50            {
 051                SqlExpression = AmqpCodec.DecodeString(buffer);
 52            }
 53
 054            if (count > 0)
 55            {
 056                CompatibilityLevel = AmqpCodec.DecodeInt(buffer);
 57            }
 058        }
 59
 60        protected override int OnValueSize()
 61        {
 062            return AmqpCodec.GetStringEncodeSize(SqlExpression) +
 063                   AmqpCodec.GetIntEncodeSize(CompatibilityLevel);
 64        }
 65    }
 66}