public async Task BasicRuleCrudOperations()
        {
            var topicName        = Guid.NewGuid().ToString("D").Substring(0, 8);
            var subscriptionName = Guid.NewGuid().ToString("D").Substring(0, 8);
            var client           = new ServiceBusManagementClient(TestEnvironment.ServiceBusConnectionString);
            await client.CreateTopicAsync(topicName);

            var rule1 = new CreateRuleOptions
            {
                Filter = new TrueRuleFilter(),
                Name   = "rule1"
            };
            await client.CreateSubscriptionAsync(
                new CreateSubscriptionOptions(topicName, subscriptionName),
                rule1);

            RuleProperties getRule1 = await client.GetRuleAsync(topicName, subscriptionName, "rule1");

            Assert.AreEqual(rule1, new CreateRuleOptions(getRule1));

            var sqlRuleFilter = new SqlRuleFilter("stringValue = @stringParam AND intValue = @intParam AND longValue = @longParam AND dateValue = @dateParam AND timeSpanValue = @timeSpanParam");

            sqlRuleFilter.Parameters.Add("@stringParam", "string");
            sqlRuleFilter.Parameters.Add("@intParam", 1);
            sqlRuleFilter.Parameters.Add("@longParam", (long)12);
            sqlRuleFilter.Parameters.Add("@dateParam", DateTime.UtcNow);
            sqlRuleFilter.Parameters.Add("@timeSpanParam", TimeSpan.FromDays(1));
            var rule2 = new CreateRuleOptions
            {
                Name   = "rule2",
                Filter = sqlRuleFilter,
                Action = new SqlRuleAction("SET a='b'")
            };
            await client.CreateRuleAsync(topicName, subscriptionName, rule2);

            RuleProperties getRule2 = await client.GetRuleAsync(topicName, subscriptionName, "rule2");

            Assert.AreEqual(rule2, new CreateRuleOptions(getRule2));

            var correlationRuleFilter = new CorrelationRuleFilter()
            {
                ContentType      = "contentType",
                CorrelationId    = "correlationId",
                Label            = "label",
                MessageId        = "messageId",
                ReplyTo          = "replyTo",
                ReplyToSessionId = "replyToSessionId",
                SessionId        = "sessionId",
                To = "to"
            };

            correlationRuleFilter.Properties.Add("customKey", "customValue");
            var rule3 = new CreateRuleOptions()
            {
                Name   = "rule3",
                Filter = correlationRuleFilter,
                Action = null
            };
            await client.CreateRuleAsync(topicName, subscriptionName, rule3);

            RuleProperties getRule3 = await client.GetRuleAsync(topicName, subscriptionName, "rule3");

            Assert.AreEqual(rule3, new CreateRuleOptions(getRule3));

            List <RuleProperties> ruleList = new List <RuleProperties>();

            await foreach (RuleProperties rule in client.GetRulesAsync(topicName, subscriptionName))
            {
                ruleList.Add(rule);
            }
            RuleProperties[] ruleArr = ruleList.ToArray();
            Assert.True(ruleArr.Length == 3);
            Assert.AreEqual(rule1, new CreateRuleOptions(ruleArr[0]));
            Assert.AreEqual(rule2, new CreateRuleOptions(ruleArr[1]));
            Assert.AreEqual(rule3, new CreateRuleOptions(ruleArr[2]));

            ((CorrelationRuleFilter)getRule3.Filter).CorrelationId = "correlationIdModified";
            SubscriptionProperties sub = await client.GetSubscriptionAsync(topicName, subscriptionName);

            RuleProperties updatedRule3 = await client.UpdateRuleAsync(topicName, subscriptionName, getRule3);

            Assert.AreEqual(getRule3, updatedRule3);

            bool exists = await client.RuleExistsAsync(topicName, subscriptionName, rule1.Name);

            Assert.True(exists);

            await client.DeleteRuleAsync(topicName, subscriptionName, "rule1");

            Assert.That(
                async() =>
                await client.GetRuleAsync(topicName, subscriptionName, "rule1"),
                Throws.InstanceOf <ServiceBusException>().And.Property(nameof(ServiceBusException.Reason)).EqualTo(ServiceBusException.FailureReason.MessagingEntityNotFound));

            exists = await client.RuleExistsAsync(topicName, subscriptionName, rule1.Name);

            Assert.False(exists);

            await client.DeleteTopicAsync(topicName);
        }