Beispiel #1
0
        public async Task DisasterRecoveryAlertnateNameCreateGetUpdateDelete()
        {
            var location          = "South Central US";
            var location2         = "North Central US";
            var resourceGroupName = Recording.GenerateAssetName(Helper.ResourceGroupPrefix);
            await ArmClient.DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(resourceGroupName, new ResourceGroupData(location));;
            var namespaceName = Recording.GenerateAssetName(Helper.NamespacePrefix);
            // Create namespace 1
            var createNamespaceResponse = await NamespacesOperations.StartCreateOrUpdateAsync(resourceGroupName, namespaceName,
                                                                                              new EHNamespace()
            {
                Location = location,
                Sku      = new Sku(SkuName.Standard)
                {
                    Tier     = SkuTier.Standard,
                    Capacity = 1
                },
                Tags =
                {
                    { "tag1", "value1" },
                    { "tag2", "value2" }
                }
            }
                                                                                              );

            var np1 = (await WaitForCompletionAsync(createNamespaceResponse)).Value;

            Assert.NotNull(createNamespaceResponse);
            Assert.AreEqual(np1.Name, namespaceName);
            DelayInTest(5);
            // Create namespace 2
            var namespaceName2           = Recording.GenerateAssetName(Helper.NamespacePrefix);
            var createNamespaceResponse2 = await NamespacesOperations.StartCreateOrUpdateAsync(resourceGroupName, namespaceName2,
                                                                                               new EHNamespace()
            {
                Location = location2,
                Sku      = new Sku(SkuName.Standard)
                {
                    Tier     = SkuTier.Standard,
                    Capacity = 1
                },
                Tags =
                {
                    { "tag1", "value1" },
                    { "tag2", "value2" }
                }
            }
                                                                                               );

            var np2 = (await WaitForCompletionAsync(createNamespaceResponse2)).Value;

            Assert.NotNull(createNamespaceResponse);
            Assert.AreEqual(np2.Name, namespaceName2);
            DelayInTest(5);
            // Create a namespace AuthorizationRule
            var authorizationRuleName           = Recording.GenerateAssetName(Helper.AuthorizationRulesPrefix);
            var createAutorizationRuleParameter = new AuthorizationRule()
            {
                Rights = { AccessRights.Listen, AccessRights.Send }
            };
            var createNamespaceAuthorizationRuleResponse = await NamespacesOperations.CreateOrUpdateAuthorizationRuleAsync(resourceGroupName, namespaceName,
                                                                                                                           authorizationRuleName, createAutorizationRuleParameter);

            Assert.NotNull(createNamespaceAuthorizationRuleResponse);
            Assert.True(createNamespaceAuthorizationRuleResponse.Value.Rights.Count == createAutorizationRuleParameter.Rights.Count);
            Assert.True(isContains(createAutorizationRuleParameter.Rights, createNamespaceAuthorizationRuleResponse.Value.Rights));
            // Get created namespace AuthorizationRules
            var getNamespaceAuthorizationRulesResponse = await NamespacesOperations.GetAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName);

            Assert.NotNull(getNamespaceAuthorizationRulesResponse);
            Assert.True(getNamespaceAuthorizationRulesResponse.Value.Rights.Count == createAutorizationRuleParameter.Rights.Count);
            Assert.True(isContains(createAutorizationRuleParameter.Rights, getNamespaceAuthorizationRulesResponse.Value.Rights));
            var getNamespaceAuthorizationRulesListKeysResponse = NamespacesOperations.ListKeysAsync(resourceGroupName, namespaceName, authorizationRuleName);
            // Create a Disaster Recovery -
            var alternateName = Recording.GenerateAssetName(Helper.DisasterRecoveryPrefix);
            //CheckNameavaliability for Alias
            var checknameAlias = await DisasterRecoveryConfigsOperations.CheckNameAvailabilityAsync(resourceGroupName, namespaceName, new CheckNameAvailabilityParameter(namespaceName));

            Assert.True(checknameAlias.Value.NameAvailable, "The Alias Name: '" + namespaceName + "' is not avilable");
            var DisasterRecoveryResponse = await DisasterRecoveryConfigsOperations.CreateOrUpdateAsync(resourceGroupName, namespaceName, namespaceName, new ArmDisasterRecovery()
            {
                PartnerNamespace = np2.Id,
                AlternateName    = alternateName
            });

            Assert.NotNull(DisasterRecoveryResponse);
            DelayInTest(30);
            //// Get the created DisasterRecovery config - Primary
            var disasterRecoveryGetResponse = await DisasterRecoveryConfigsOperations.GetAsync(resourceGroupName, namespaceName, namespaceName);

            Assert.NotNull(disasterRecoveryGetResponse);
            Assert.AreEqual(RoleDisasterRecovery.Primary, disasterRecoveryGetResponse.Value.Role);
            //// Get the created DisasterRecovery config - Secondary
            var disasterRecoveryGetResponse_Sec = await DisasterRecoveryConfigsOperations.GetAsync(resourceGroupName, namespaceName2, namespaceName);

            Assert.NotNull(disasterRecoveryGetResponse_Sec);
            Assert.AreEqual(RoleDisasterRecovery.Secondary, disasterRecoveryGetResponse_Sec.Value.Role);
            //Get authorization rule thorugh Alias
            var getAuthoRuleAliasResponse = await DisasterRecoveryConfigsOperations.GetAuthorizationRuleAsync(resourceGroupName, namespaceName, namespaceName, authorizationRuleName);

            Assert.AreEqual(getAuthoRuleAliasResponse.Value.Name, getNamespaceAuthorizationRulesResponse.Value.Name);
            var getAuthoruleListKeysResponse = await DisasterRecoveryConfigsOperations.ListKeysAsync(resourceGroupName, namespaceName, namespaceName, authorizationRuleName);

            var disasterRecoveryGetResponse_Accepted = await DisasterRecoveryConfigsOperations.GetAsync(resourceGroupName, namespaceName, namespaceName);

            while (DisasterRecoveryConfigsOperations.GetAsync(resourceGroupName, namespaceName, namespaceName).Result.Value.ProvisioningState != ProvisioningStateDR.Succeeded)
            {
                DelayInTest(10);
            }
            //// Break Pairing
            await DisasterRecoveryConfigsOperations.BreakPairingAsync(resourceGroupName, namespaceName, namespaceName);

            DelayInTest(10);
            disasterRecoveryGetResponse_Accepted = await DisasterRecoveryConfigsOperations.GetAsync(resourceGroupName, namespaceName, namespaceName);

            while (DisasterRecoveryConfigsOperations.GetAsync(resourceGroupName, namespaceName, namespaceName).Result.Value.ProvisioningState != ProvisioningStateDR.Succeeded)
            {
                DelayInTest(10);
            }
            var DisasterRecoveryResponse_update = DisasterRecoveryConfigsOperations.CreateOrUpdateAsync(resourceGroupName, namespaceName, namespaceName, new ArmDisasterRecovery()
            {
                PartnerNamespace = np2.Id,
                AlternateName    = alternateName
            });

            Assert.NotNull(DisasterRecoveryResponse_update);
            DelayInTest(10);
            while (DisasterRecoveryConfigsOperations.GetAsync(resourceGroupName, namespaceName, namespaceName).Result.Value.ProvisioningState != ProvisioningStateDR.Succeeded)
            {
                DelayInTest(10);
            }
            // Fail over
            await DisasterRecoveryConfigsOperations.FailOverAsync(resourceGroupName, namespaceName2, namespaceName);

            DelayInTest(10);
            while (DisasterRecoveryConfigsOperations.GetAsync(resourceGroupName, namespaceName2, namespaceName).Result.Value.ProvisioningState != ProvisioningStateDR.Succeeded)
            {
                DelayInTest(10);
            }
            // Get all Disaster Recovery for a given NameSpace
            var getListisasterRecoveryResponse = DisasterRecoveryConfigsOperations.ListAsync(resourceGroupName, namespaceName2);

            Assert.NotNull(getListisasterRecoveryResponse);
            //Assert.True(getListisasterRecoveryResponse.AsPages.Count<ArmDisasterRecovery>() >= 1);
            // Delete the DisasterRecovery
            await DisasterRecoveryConfigsOperations.DeleteAsync(resourceGroupName, namespaceName2, namespaceName);

            // Delete Namespace using Async
            //await NamespacesClient.StartDeleteAsync(resourceGroupName, namespaceName, new CancellationToken()).ConfigureAwait(false);
            ////NamespacesClient.DeleteWithHttpMessages(resourceGroupName, namespaceName, null, new CancellationToken()).ConfigureAwait(false);
            //await NamespacesClient.StartDeleteAsync(resourceGroupName, namespaceName2, new CancellationToken()).ConfigureAwait(false);
        }
        public async Task DisasterRecoveryCreateGetUpdateDelete()
        {
            var location      = "South Central US";
            var location2     = "North Central US";
            var resourceGroup = Recording.GenerateAssetName(Helper.ResourceGroupPrefix);
            await Helper.TryRegisterResourceGroupAsync(ResourceGroupsOperations, location, resourceGroup);

            var namespaceName = Recording.GenerateAssetName(Helper.NamespacePrefix);
            // Create namespace 1
            var createNamespaceResponse = await NamespacesOperations.StartCreateOrUpdateAsync(resourceGroup, namespaceName,
                                                                                              new EHNamespace()
            {
                Location = location,
                Sku      = new Sku(SkuName.Standard)
                {
                    Tier     = SkuTier.Standard,
                    Capacity = 1
                },
                Tags = new Dictionary <string, string>()
                {
                    { "tag1", "value1" },
                    { "tag2", "value2" }
                }
            }
                                                                                              );

            var np1 = (await WaitForCompletionAsync(createNamespaceResponse)).Value;

            Assert.NotNull(createNamespaceResponse);
            Assert.AreEqual(np1.Name, namespaceName);
            DelayInTest(5);

            // Create namespace 2
            var namespaceName2           = Recording.GenerateAssetName(Helper.NamespacePrefix);
            var createNamespaceResponse2 = await NamespacesOperations.StartCreateOrUpdateAsync(resourceGroup, namespaceName2,
                                                                                               new EHNamespace()
            {
                Location = location2,
                //Sku = new Sku
                //{
                //    Name = SkuName.Standard,
                //    Tier = SkuTier.Standard,
                //    Capacity = 1
                //},
                Tags = new Dictionary <string, string>()
                {
                    { "tag1", "value1" },
                    { "tag2", "value2" }
                }
            }
                                                                                               );

            var np2 = (await WaitForCompletionAsync(createNamespaceResponse2)).Value;

            Assert.NotNull(createNamespaceResponse);
            Assert.AreEqual(np2.Name, namespaceName2);
            DelayInTest(5);

            // Create a namespace AuthorizationRule
            var authorizationRuleName           = Recording.GenerateAssetName(Helper.AuthorizationRulesPrefix);
            var createAutorizationRuleParameter = new AuthorizationRule()
            {
                Rights = new List <AccessRights>()
                {
                    AccessRights.Listen, AccessRights.Send
                }
            };

            var createNamespaceAuthorizationRuleResponse = await NamespacesOperations.CreateOrUpdateAuthorizationRuleAsync(resourceGroup, namespaceName,
                                                                                                                           authorizationRuleName, createAutorizationRuleParameter);

            Assert.NotNull(createNamespaceAuthorizationRuleResponse);
            Assert.True(createNamespaceAuthorizationRuleResponse.Value.Rights.Count == createAutorizationRuleParameter.Rights.Count);
            Assert.True(isContains(createAutorizationRuleParameter.Rights, createNamespaceAuthorizationRuleResponse.Value.Rights));
            // Get created namespace AuthorizationRules
            var getNamespaceAuthorizationRulesResponse = await NamespacesOperations.GetAuthorizationRuleAsync(resourceGroup, namespaceName, authorizationRuleName);

            Assert.NotNull(getNamespaceAuthorizationRulesResponse);
            Assert.True(getNamespaceAuthorizationRulesResponse.Value.Rights.Count == createAutorizationRuleParameter.Rights.Count);
            Assert.True(isContains(createAutorizationRuleParameter.Rights, getNamespaceAuthorizationRulesResponse.Value.Rights));
            var getNamespaceAuthorizationRulesListKeysResponse = NamespacesOperations.ListKeysAsync(resourceGroup, namespaceName, authorizationRuleName);
            // Create a Disaster Recovery -
            var disasterRecoveryName = Recording.GenerateAssetName(Helper.DisasterRecoveryPrefix);
            //CheckNameavaliability for Alias
            var checknameAlias = await DisasterRecoveryConfigsOperations.CheckNameAvailabilityAsync(resourceGroup, namespaceName, new CheckNameAvailabilityParameter(disasterRecoveryName));

            Assert.True(checknameAlias.Value.NameAvailable, "The Alias Name: '" + disasterRecoveryName + "' is not avilable");
            //CheckNameAvaliability for Alias with same as namespace name (alternateName will be used in this case)
            var checknameAliasSame = await DisasterRecoveryConfigsOperations.CheckNameAvailabilityAsync(resourceGroup, namespaceName, new CheckNameAvailabilityParameter(namespaceName));

            // Assert.True(checknameAliasSame.NameAvailable, "The Alias Name: '" + namespaceName + "' is not avilable");
            var DisasterRecoveryResponse = await DisasterRecoveryConfigsOperations.CreateOrUpdateAsync(resourceGroup, namespaceName, disasterRecoveryName, new ArmDisasterRecovery()
            {
                PartnerNamespace = np2.Id
            });

            Assert.NotNull(DisasterRecoveryResponse);
            DelayInTest(30);

            //// Get the created DisasterRecovery config - Primary
            var disasterRecoveryGetResponse = await DisasterRecoveryConfigsOperations.GetAsync(resourceGroup, namespaceName, disasterRecoveryName);

            Assert.NotNull(disasterRecoveryGetResponse);
            if (disasterRecoveryGetResponse.Value.PendingReplicationOperationsCount.HasValue)
            {
                Assert.True(disasterRecoveryGetResponse.Value.PendingReplicationOperationsCount >= 0);
            }
            else
            {
                Assert.False(disasterRecoveryGetResponse.Value.PendingReplicationOperationsCount.HasValue);
            }
            Assert.AreEqual(RoleDisasterRecovery.Primary, disasterRecoveryGetResponse.Value.Role);
            //// Get the created DisasterRecovery config - Secondary
            var disasterRecoveryGetResponse_Sec = await DisasterRecoveryConfigsOperations.GetAsync(resourceGroup, namespaceName2, disasterRecoveryName);

            Assert.AreEqual(RoleDisasterRecovery.Secondary, disasterRecoveryGetResponse_Sec.Value.Role);
            //Get authorization rule thorugh Alias
            var getAuthoRuleAliasResponse = await DisasterRecoveryConfigsOperations.GetAuthorizationRuleAsync(resourceGroup, namespaceName, disasterRecoveryName, authorizationRuleName);

            Assert.AreEqual(getAuthoRuleAliasResponse.Value.Name, getNamespaceAuthorizationRulesResponse.Value.Name);
            var getAuthoruleListKeysResponse = await DisasterRecoveryConfigsOperations.ListKeysAsync(resourceGroup, namespaceName, disasterRecoveryName, authorizationRuleName);

            Assert.True(string.IsNullOrEmpty(getAuthoruleListKeysResponse.Value.PrimaryConnectionString));
            Assert.True(string.IsNullOrEmpty(getAuthoruleListKeysResponse.Value.SecondaryConnectionString));
            while (DisasterRecoveryConfigsOperations.GetAsync(resourceGroup, namespaceName, disasterRecoveryName).Result.Value.ProvisioningState != ProvisioningStateDR.Succeeded)
            {
                DelayInTest(10);
            }
            disasterRecoveryGetResponse = await DisasterRecoveryConfigsOperations.GetAsync(resourceGroup, namespaceName, disasterRecoveryName);

            if (disasterRecoveryGetResponse.Value.PendingReplicationOperationsCount.HasValue)
            {
                Assert.True(disasterRecoveryGetResponse.Value.PendingReplicationOperationsCount >= 0);
            }
            else
            {
                Assert.False(disasterRecoveryGetResponse.Value.PendingReplicationOperationsCount.HasValue);
            }
            //// Break Pairing
            await DisasterRecoveryConfigsOperations.BreakPairingAsync(resourceGroup, namespaceName, disasterRecoveryName);

            DelayInTest(10);
            while (DisasterRecoveryConfigsOperations.GetAsync(resourceGroup, namespaceName, disasterRecoveryName).Result.Value.ProvisioningState != ProvisioningStateDR.Succeeded)
            {
                DelayInTest(10);
            }
            var DisasterRecoveryResponse_update = await DisasterRecoveryConfigsOperations.CreateOrUpdateAsync(resourceGroup, namespaceName, disasterRecoveryName, new ArmDisasterRecovery()
            {
                PartnerNamespace = np2.Id
            });

            Assert.NotNull(DisasterRecoveryResponse_update);
            DelayInTest(10);
            var getGeoDRResponse = await DisasterRecoveryConfigsOperations.GetAsync(resourceGroup, namespaceName, disasterRecoveryName);

            while (getGeoDRResponse.Value.ProvisioningState != ProvisioningStateDR.Succeeded)
            {
                getGeoDRResponse = await DisasterRecoveryConfigsOperations.GetAsync(resourceGroup, namespaceName, disasterRecoveryName);

                DelayInTest(10);
            }
            getGeoDRResponse = await DisasterRecoveryConfigsOperations.GetAsync(resourceGroup, namespaceName, disasterRecoveryName);

            if (getGeoDRResponse.Value.PendingReplicationOperationsCount.HasValue)
            {
                Assert.True(getGeoDRResponse.Value.PendingReplicationOperationsCount >= 0);
            }
            else
            {
                Assert.False(getGeoDRResponse.Value.PendingReplicationOperationsCount.HasValue);
            }
            // Fail over
            await DisasterRecoveryConfigsOperations.FailOverAsync(resourceGroup, namespaceName2, disasterRecoveryName);

            DelayInTest(10);
            while (DisasterRecoveryConfigsOperations.GetAsync(resourceGroup, namespaceName2, disasterRecoveryName).Result.Value.ProvisioningState != ProvisioningStateDR.Succeeded)
            {
                DelayInTest(10);
            }
            // Get all Disaster Recovery for a given NameSpace
            var getListisasterRecoveryResponse = DisasterRecoveryConfigsOperations.ListAsync(resourceGroup, namespaceName2);

            Assert.NotNull(getListisasterRecoveryResponse);
            //Assert.True(getListisasterRecoveryResponse.AsPages.Count<ArmDisasterRecovery>() >= 1);
            // Delete the DisasterRecovery
            await DisasterRecoveryConfigsOperations.DeleteAsync(resourceGroup, namespaceName2, disasterRecoveryName);

            // Delete Namespace using Async
            await WaitForCompletionAsync(await NamespacesOperations.StartDeleteAsync(resourceGroup, namespaceName));
            await WaitForCompletionAsync(await NamespacesOperations.StartDeleteAsync(resourceGroup, namespaceName2));
        }
        public async Task NamespaceCreateGetUpdateDeleteAuthorizationRules()
        {
            var location = await GetLocation();

            var resourceGroupName = Recording.GenerateAssetName(Helper.ResourceGroupPrefix);
            await ArmClient.DefaultSubscription.GetResourceGroups().CreateOrUpdateAsync(resourceGroupName, new ResourceGroupData(location));;
            var namespaceName           = Recording.GenerateAssetName(Helper.NamespacePrefix);
            var createNamespaceResponse = await NamespacesOperations.StartCreateOrUpdateAsync(resourceGroupName, namespaceName,
                                                                                              new EHNamespace()
            {
                Location = location,
                //Sku = new Sku("as")
                Tags =
                {
                    { "tag1", "value1" },
                    { "tag2", "value2" }
                }
            }
                                                                                              );

            var np = (await WaitForCompletionAsync(createNamespaceResponse)).Value;

            Assert.NotNull(createNamespaceResponse);
            Assert.AreEqual(np.Name, namespaceName);
            DelayInTest(5);
            //get the created namespace
            var getNamespaceResponse = await NamespacesOperations.GetAsync(resourceGroupName, namespaceName);

            if (string.Compare(getNamespaceResponse.Value.ProvisioningState, "Succeeded", true) != 0)
            {
                DelayInTest(5);
            }
            getNamespaceResponse = await NamespacesOperations.GetAsync(resourceGroupName, namespaceName);

            Assert.NotNull(getNamespaceResponse);
            Assert.AreEqual("Succeeded", getNamespaceResponse.Value.ProvisioningState, StringComparer.CurrentCultureIgnoreCase.ToString());
            Assert.AreEqual(location, getNamespaceResponse.Value.Location);
            // Create a namespace AuthorizationRule
            var    authorizationRuleName           = Recording.GenerateAssetName(Helper.AuthorizationRulesPrefix);
            string createPrimaryKey                = Recording.GetVariable("authorizaRuNa", Helper.GenerateRandomKey());
            var    createAutorizationRuleParameter = new AuthorizationRule()
            {
                Rights = { AccessRights.Listen, AccessRights.Send }
            };
            var createNamespaceAuthorizationRuleResponse = await NamespacesOperations.CreateOrUpdateAuthorizationRuleAsync(resourceGroupName, namespaceName,
                                                                                                                           authorizationRuleName, createAutorizationRuleParameter);

            Assert.NotNull(createNamespaceAuthorizationRuleResponse);
            Assert.True(createNamespaceAuthorizationRuleResponse.Value.Rights.Count == createAutorizationRuleParameter.Rights.Count);
            Assert.True(isContains(createAutorizationRuleParameter.Rights, createNamespaceAuthorizationRuleResponse.Value.Rights));
            // Get default namespace AuthorizationRules
            var getNamespaceAuthorizationRulesResponse = await NamespacesOperations.GetAuthorizationRuleAsync(resourceGroupName, namespaceName, Helper.DefaultNamespaceAuthorizationRule);

            Assert.NotNull(getNamespaceAuthorizationRulesResponse);
            Assert.AreEqual(getNamespaceAuthorizationRulesResponse.Value.Name, Helper.DefaultNamespaceAuthorizationRule);
            var accessRights = new List <AccessRights>()
            {
                AccessRights.Listen, AccessRights.Send, AccessRights.Manage
            };

            Assert.True(isContains(getNamespaceAuthorizationRulesResponse.Value.Rights, accessRights));
            // Get created namespace AuthorizationRules
            getNamespaceAuthorizationRulesResponse = await NamespacesOperations.GetAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName);

            Assert.NotNull(getNamespaceAuthorizationRulesResponse);
            Assert.True(getNamespaceAuthorizationRulesResponse.Value.Rights.Count == createAutorizationRuleParameter.Rights.Count);
            Assert.True(isContains(createAutorizationRuleParameter.Rights, getNamespaceAuthorizationRulesResponse.Value.Rights));
            // Get all namespaces AuthorizationRules
            var getAllNamespaceAuthorizationRulesResponse = NamespacesOperations.ListAuthorizationRulesAsync(resourceGroupName, namespaceName);

            Assert.NotNull(getAllNamespaceAuthorizationRulesResponse);
            var getAllNpsAuthResp = await getAllNamespaceAuthorizationRulesResponse.ToEnumerableAsync();

            Assert.True(getAllNpsAuthResp.Count() > 1);
            bool isContainAuthorizationRuleName    = false;
            bool isContainEventHubManagementHelper = false;

            foreach (var Authrule in getAllNpsAuthResp)
            {
                if (Authrule.Name == authorizationRuleName)
                {
                    isContainAuthorizationRuleName = true;
                    break;
                }
            }
            foreach (var Authrule in getAllNpsAuthResp)
            {
                if (Authrule.Name == Helper.DefaultNamespaceAuthorizationRule)
                {
                    isContainEventHubManagementHelper = true;
                    break;
                }
            }
            Assert.True(isContainAuthorizationRuleName);
            Assert.True(isContainEventHubManagementHelper);
            // Update namespace authorizationRule
            string            updatePrimaryKey = Recording.GetVariable("UpdatePrimaryKey", Helper.GenerateRandomKey());
            AuthorizationRule updateNamespaceAuthorizationRuleParameter = new AuthorizationRule();

            updateNamespaceAuthorizationRuleParameter.Rights.Add(AccessRights.Listen);
            var updateNamespaceAuthorizationRuleResponse = await NamespacesOperations.CreateOrUpdateAuthorizationRuleAsync(resourceGroupName,
                                                                                                                           namespaceName, authorizationRuleName, updateNamespaceAuthorizationRuleParameter);

            Assert.NotNull(updateNamespaceAuthorizationRuleResponse);
            Assert.AreEqual(authorizationRuleName, updateNamespaceAuthorizationRuleResponse.Value.Name);
            Assert.True(updateNamespaceAuthorizationRuleResponse.Value.Rights.Count == updateNamespaceAuthorizationRuleParameter.Rights.Count);
            Assert.True(isContains(updateNamespaceAuthorizationRuleParameter.Rights, updateNamespaceAuthorizationRuleResponse.Value.Rights));
            // Get the updated namespace AuthorizationRule
            var getNamespaceAuthorizationRuleResponse = await NamespacesOperations.GetAuthorizationRuleAsync(resourceGroupName, namespaceName,
                                                                                                             authorizationRuleName);

            Assert.NotNull(getNamespaceAuthorizationRuleResponse);
            Assert.AreEqual(authorizationRuleName, getNamespaceAuthorizationRuleResponse.Value.Name);
            Assert.True(getNamespaceAuthorizationRuleResponse.Value.Rights.Count == updateNamespaceAuthorizationRuleParameter.Rights.Count);
            Assert.True(isContains(updateNamespaceAuthorizationRuleParameter.Rights, getNamespaceAuthorizationRuleResponse.Value.Rights));
            // Get the connection string to the namespace for a Authorization rule created
            var listKeysResponse = await NamespacesOperations.ListKeysAsync(resourceGroupName, namespaceName, authorizationRuleName);

            Assert.NotNull(listKeysResponse);
            Assert.NotNull(listKeysResponse.Value.PrimaryConnectionString);
            Assert.NotNull(listKeysResponse.Value.SecondaryConnectionString);
            // Regenerate connection string to the namespace for a Authorization rule created
            var NewKeysResponse_primary = await NamespacesOperations.RegenerateKeysAsync(resourceGroupName, namespaceName, authorizationRuleName, new RegenerateAccessKeyParameters(KeyType.PrimaryKey));

            Assert.NotNull(NewKeysResponse_primary);
            // Assert.AreNotEqual(NewKeysResponse_primary.Value.PrimaryConnectionString, listKeysResponse.Value.PrimaryConnectionString);
            Assert.AreEqual(NewKeysResponse_primary.Value.SecondaryConnectionString, listKeysResponse.Value.SecondaryConnectionString);
            // Regenerate connection string to the namespace for a Authorization rule created
            var NewKeysResponse_secondary = await NamespacesOperations.RegenerateKeysAsync(resourceGroupName, namespaceName, authorizationRuleName, new RegenerateAccessKeyParameters(KeyType.SecondaryKey));

            Assert.NotNull(NewKeysResponse_secondary);
            // Assert.AreNotEqual(NewKeysResponse_secondary.Value.PrimaryConnectionString, listKeysResponse.Value.PrimaryConnectionString);
            // Assert.AreNotEqual(NewKeysResponse_secondary.Value.SecondaryConnectionString, listKeysResponse.Value.SecondaryConnectionString);
            // Delete namespace authorizationRule
            await NamespacesOperations.DeleteAuthorizationRuleAsync(resourceGroupName, namespaceName, authorizationRuleName);

            DelayInTest(5);
            // Delete namespace
            await WaitForCompletionAsync(await NamespacesOperations.StartDeleteAsync(resourceGroupName, namespaceName));
        }