< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.cctor()-0%100%
.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\Microsoft.Azure.ServiceBus\src\Amqp\Framing\AmqpSqlRuleActionCodec.cs

#LineLine coverage
 1// Copyright (c) Microsoft. All rights reserved.
 2// Licensed under the MIT license. See LICENSE file in the project root for full license information.
 3
 4namespace Microsoft.Azure.ServiceBus.Amqp.Framing
 5{
 6    using System.Text;
 7    using Azure.Amqp;
 8
 9    sealed class AmqpSqlRuleActionCodec : AmqpRuleActionCodec
 10    {
 011        public static readonly string Name = AmqpConstants.Vendor + ":sql-rule-action:list";
 12        public const ulong Code = 0x0000013700000006;
 13        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            this.AddFieldToString(this.SqlExpression != null, sb, "expression", this.SqlExpression, ref count);
 036            this.AddFieldToString(this.CompatibilityLevel != null, sb, "level", this.CompatibilityLevel, ref count);
 037            sb.Append(')');
 038            return sb.ToString();
 39        }
 40
 41        protected override void OnEncode(ByteBuffer buffer)
 42        {
 043            AmqpCodec.EncodeString(this.SqlExpression, buffer);
 044            AmqpCodec.EncodeInt(this.CompatibilityLevel, buffer);
 045        }
 46
 47        protected override void OnDecode(ByteBuffer buffer, int count)
 48        {
 049            if (count-- > 0)
 50            {
 051                this.SqlExpression = AmqpCodec.DecodeString(buffer);
 52            }
 53
 054            if (count > 0)
 55            {
 056                this.CompatibilityLevel = AmqpCodec.DecodeInt(buffer);
 57            }
 058        }
 59
 60        protected override int OnValueSize()
 61        {
 062            return AmqpCodec.GetStringEncodeSize(this.SqlExpression) +
 063                   AmqpCodec.GetIntEncodeSize(this.CompatibilityLevel);
 64        }
 65    }
 66}