< Summary

Class:Microsoft.Azure.ServiceBus.Amqp.Framing.AmqpSqlFilterCodec
Assembly:Microsoft.Azure.ServiceBus
File(s):C:\Git\azure-sdk-for-net\sdk\servicebus\Microsoft.Azure.ServiceBus\src\Amqp\Framing\AmqpSqlFilterCodec.cs
Covered lines:0
Uncovered lines:21
Coverable lines:21
Total lines:59
Line coverage:0% (0 of 21)
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_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\Microsoft.Azure.ServiceBus\src\Amqp\Framing\AmqpSqlFilterCodec.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 AmqpSqlFilterCodec : AmqpFilterCodec
 10    {
 011        public static readonly string Name = AmqpConstants.Vendor + ":sql-filter:list";
 12        public const ulong Code = 0x000001370000006;
 13        const int Fields = 2;
 14
 015        public AmqpSqlFilterCodec() : 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            this.AddFieldToString(this.Expression != null, stringBuilder, "expression", this.Expression, ref count);
 028            this.AddFieldToString(this.CompatibilityLevel != null, stringBuilder, "level", this.CompatibilityLevel, ref 
 029            stringBuilder.Append(')');
 030            return stringBuilder.ToString();
 31        }
 32
 33        protected override void OnEncode(ByteBuffer buffer)
 34        {
 035            AmqpCodec.EncodeString(this.Expression, buffer);
 036            AmqpCodec.EncodeInt(this.CompatibilityLevel, buffer);
 037        }
 38
 39        protected override void OnDecode(ByteBuffer buffer, int count)
 40        {
 041            if (count-- > 0)
 42            {
 043                this.Expression = AmqpCodec.DecodeString(buffer);
 44            }
 45
 046            if (count > 0)
 47            {
 048                this.CompatibilityLevel = AmqpCodec.DecodeInt(buffer);
 49            }
 050        }
 51
 52        protected override int OnValueSize()
 53        {
 054            return AmqpCodec.GetStringEncodeSize(this.Expression) +
 055                   AmqpCodec.GetIntEncodeSize(this.CompatibilityLevel);
 56        }
 57    }
 58
 59}