< Summary

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

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
.ctor()-0%100%
get_Filter()-0%100%
get_Action()-0%100%
get_RuleName()-0%100%
get_CreatedAt()-0%100%
get_FieldCount()-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\AmqpRuleDescriptionCodec.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License.
 3
 4using System;
 5using Microsoft.Azure.Amqp;
 6using Microsoft.Azure.Amqp.Framing;
 7
 8namespace Azure.Messaging.ServiceBus.Amqp.Framing
 9{
 10    internal sealed class AmqpRuleDescriptionCodec : DescribedList
 11    {
 12        public const string Name = AmqpConstants.Vendor + ":rule-description:list";
 13        public const ulong Code = 0x0000013700000004;
 14        private const int Fields = 4;
 15
 016        public AmqpRuleDescriptionCodec() : base(Name, Code) { }
 17
 018        public AmqpRuleFilterCodec Filter { get; set; }
 19
 020        public AmqpRuleActionCodec Action { get; set; }
 21
 022        public string RuleName { get; set; }
 23
 024        public DateTime? CreatedAt { get; set; }
 25
 026        protected override int FieldCount => Fields;
 27
 28        protected override void OnEncode(ByteBuffer buffer)
 29        {
 030            AmqpCodec.EncodeSerializable(Filter, buffer);
 031            AmqpCodec.EncodeSerializable(Action, buffer);
 032            AmqpCodec.EncodeString(RuleName, buffer);
 033            AmqpCodec.EncodeTimeStamp(CreatedAt, buffer);
 034        }
 35
 36        protected override void OnDecode(ByteBuffer buffer, int count)
 37        {
 038            if (count-- > 0)
 39            {
 040                Filter = (AmqpRuleFilterCodec)AmqpCodec.DecodeAmqpDescribed(buffer);
 41            }
 42
 043            if (count-- > 0)
 44            {
 045                Action = (AmqpRuleActionCodec)AmqpCodec.DecodeAmqpDescribed(buffer);
 46            }
 47
 048            if (count-- > 0)
 49            {
 050                RuleName = AmqpCodec.DecodeString(buffer);
 51            }
 52
 053            if (count > 0)
 54            {
 055                CreatedAt = AmqpCodec.DecodeTimeStamp(buffer);
 56            }
 057        }
 58
 59        protected override int OnValueSize()
 60        {
 061            return AmqpCodec.GetSerializableEncodeSize(Filter) +
 062                   AmqpCodec.GetSerializableEncodeSize(Action) +
 063                   AmqpCodec.GetStringEncodeSize(RuleName) +
 064                   AmqpCodec.GetTimeStampEncodeSize(CreatedAt);
 65        }
 66    }
 67}