Ejemplo n.º 1
0
        public async Task CreateStorageAccountAndGetTableCollection()
        {
            _resourceGroup = await CreateResourceGroupAsync();

            string accountName = await CreateValidAccountNameAsync("teststoragemgmt");

            StorageAccountCollection storageAccountCollection = _resourceGroup.GetStorageAccounts();

            _storageAccount = (await storageAccountCollection.CreateOrUpdateAsync(WaitUntil.Completed, accountName, GetDefaultStorageAccountParameters())).Value;
            _tableService   = _storageAccount.GetTableService();
            _tableService   = await _tableService.GetAsync();

            _tableCollection = _tableService.GetTables();
        }
Ejemplo n.º 2
0
        public async Task UpdateTableService()
        {
            //update cors
            CorsRules cors = new CorsRules();

            cors.CorsRulesValue.Add(new CorsRule(
                                        allowedHeaders: new string[] { "x-ms-meta-abc", "x-ms-meta-data*", "x-ms-meta-target*" },
                                        allowedMethods: new CorsRuleAllowedMethodsItem[] { "GET", "HEAD", "POST", "OPTIONS", "MERGE", "PUT" },
                                        allowedOrigins: new string[] { "http://www.contoso.com", "http://www.fabrikam.com" },
                                        exposedHeaders: new string[] { "x-ms-meta-*" },
                                        maxAgeInSeconds: 100));
            TableServiceData parameter = new TableServiceData()
            {
                Cors = cors,
            };

            _tableService = (await _tableService.CreateOrUpdateAsync(WaitUntil.Completed, parameter)).Value;

            //validate
            Assert.AreEqual(_tableService.Data.Cors.CorsRulesValue.Count, 1);
        }