public void CreateVault(string resourceGroupName, string resourceName, string location)
        {
            RecoveryServicesTestsBase testsBase = new RecoveryServicesTestsBase();
            var rsClient = testsBase.GetRecoveryServicesClient(RsCustomHttpHandler);

            if (!IsVaultPresent(resourceGroupName, resourceName))
            {
                VaultCreateArgs vaultCreateArgs = new VaultCreateArgs();
                vaultCreateArgs.Location   = location;
                vaultCreateArgs.Properties = new VaultProperties();
                vaultCreateArgs.Sku        = new VaultSku();
                vaultCreateArgs.Sku.Name   = "standard";
                VaultCreateResponse response = rsClient.Vaults.BeginCreating(resourceGroupName, resourceName, vaultCreateArgs);

                Assert.NotNull(response.Name);
                Assert.NotNull(response.Id);
                Assert.NotNull(response.Properties.ProvisioningState);
                Assert.Equal(HttpStatusCode.Created, response.StatusCode);
            }
        }
        public bool IsVaultPresent(string resourceGroupName, string resourceName)
        {
            RecoveryServicesTestsBase testsBase = new RecoveryServicesTestsBase();
            var rsClient = testsBase.GetRecoveryServicesClient(RsCustomHttpHandler);

            bool vaultExists = true;

            try
            {
                VaultResponse response = rsClient.Vaults.Get(resourceGroupName, resourceName, RsCustomRequestHeaders);

                Assert.NotNull(response.Vault.Name);
                Assert.NotNull(response.Vault.Id);
                Assert.NotNull(response.Vault.Properties.ProvisioningState);
                Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            }
            catch (Exception)
            {
                vaultExists = false;
            }

            return(vaultExists);
        }