< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
get_Expression()-0%100%
get_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\AmqpSqlRuleFilterCodec.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 AmqpSqlRuleFilterCodec : AmqpRuleFilterCodec
 10    {
 11        public const string Name = AmqpConstants.Vendor + ":sql-filter:list";
 12        public const ulong Code = 0x000001370000006;
 13        private const int Fields = 2;
 14
 015        public AmqpSqlRuleFilterCodec() : base(Name, Code) { }
 16
 017        public string Expression { get; set; }
 18
 019        public int? CompatibilityLevel { get; set; }
 20
 021        protected override int FieldCount => Fields;
 22
 23        public override string ToString()
 24        {
 025            var stringBuilder = new StringBuilder("sql(");
 026            var count = 0;
 027            AddFieldToString(Expression != null, stringBuilder, "expression", Expression, ref count);
 028            AddFieldToString(CompatibilityLevel != null, stringBuilder, "level", CompatibilityLevel, ref count);
 029            stringBuilder.Append(')');
 030            return stringBuilder.ToString();
 31        }
 32
 33        protected override void OnEncode(ByteBuffer buffer)
 34        {
 035            AmqpCodec.EncodeString(Expression, buffer);
 036            AmqpCodec.EncodeInt(CompatibilityLevel, buffer);
 037        }
 38
 39        protected override void OnDecode(ByteBuffer buffer, int count)
 40        {
 041            if (count-- > 0)
 42            {
 043                Expression = AmqpCodec.DecodeString(buffer);
 44            }
 45
 046            if (count > 0)
 47            {
 048                CompatibilityLevel = AmqpCodec.DecodeInt(buffer);
 49            }
 050        }
 51
 52        protected override int OnValueSize()
 53        {
 054            return AmqpCodec.GetStringEncodeSize(Expression) +
 055                   AmqpCodec.GetIntEncodeSize(CompatibilityLevel);
 56        }
 57    }
 58}