diff --git a/src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs b/src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs index 62efa1b..d7d1339 100644 --- a/src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs +++ b/src/Microsoft.Azure.ServiceBus/Amqp/AmqpMessageConverter.cs @@ -357,6 +357,7 @@ namespace Microsoft.Azure.ServiceBus.Amqp AmqpMap amqpAction = GetRuleActionMap(description.Action as SqlRuleAction); ruleDescriptionMap[ManagementConstants.Properties.SqlRuleAction] = amqpAction; + ruleDescriptionMap[ManagementConstants.Properties.RuleName] = description.Name; return ruleDescriptionMap; } diff --git a/test/Microsoft.Azure.ServiceBus.UnitTests/SubscriptionClientTests.cs b/test/Microsoft.Azure.ServiceBus.UnitTests/SubscriptionClientTests.cs index 299cdb7..0dcf00e 100644 --- a/test/Microsoft.Azure.ServiceBus.UnitTests/SubscriptionClientTests.cs +++ b/test/Microsoft.Azure.ServiceBus.UnitTests/SubscriptionClientTests.cs @@ -38,9 +38,9 @@ namespace Microsoft.Azure.ServiceBus.UnitTests { await subscriptionClient.RemoveRuleAsync(RuleDescription.DefaultRuleName); } - catch + catch (Exception e) { - // ignored + TestUtility.Log($"Remove Default Rule failed with Exception: {e.Message}"); } await subscriptionClient.AddRuleAsync(new RuleDescription @@ -64,8 +64,16 @@ namespace Microsoft.Azure.ServiceBus.UnitTests } finally { - await subscriptionClient.RemoveRuleAsync("RedCorrelation"); - await subscriptionClient.AddRuleAsync(RuleDescription.DefaultRuleName, new TrueFilter()); + try + { + await subscriptionClient.RemoveRuleAsync("RedCorrelation"); + await subscriptionClient.AddRuleAsync(RuleDescription.DefaultRuleName, new TrueFilter()); + } + catch (Exception e) + { + TestUtility.Log($" Cleanup failed with Exception: {e.Message}"); + } + await subscriptionClient.CloseAsync(); await topicClient.CloseAsync(); } @@ -89,9 +97,9 @@ namespace Microsoft.Azure.ServiceBus.UnitTests { await subscriptionClient.RemoveRuleAsync(RuleDescription.DefaultRuleName); } - catch + catch(Exception e) { - // ignored + TestUtility.Log($"Remove Default Rule failed with: {e.Message}"); } await subscriptionClient.AddRuleAsync(new RuleDescription @@ -121,12 +129,20 @@ namespace Microsoft.Azure.ServiceBus.UnitTests var messages = await subscriptionClient.InnerSubscriptionClient.InnerReceiver.ReceiveAsync(maxMessageCount: 2); Assert.NotNull(messages); Assert.True(messages.Count == 1); - Assert.True(messageId2.Equals(messages.First().MessageId)); + Assert.True(messageId2.Equals(messages.First().MessageId)); } finally { - await subscriptionClient.RemoveRuleAsync("RedSql"); - await subscriptionClient.AddRuleAsync(RuleDescription.DefaultRuleName, new TrueFilter()); + try + { + await subscriptionClient.RemoveRuleAsync("RedSql"); + await subscriptionClient.AddRuleAsync(RuleDescription.DefaultRuleName, new TrueFilter()); + } + catch (Exception e) + { + TestUtility.Log($" Cleanup failed with Exception: {e.Message}"); + } + await subscriptionClient.CloseAsync(); await topicClient.CloseAsync(); }