Пример #1
0
        public static void StorageAccountTestInit(TestContext testContext)
        {
            TestBase.TestClassInitialize(testContext);

            if (isResourceMode)
            {
                NodeJSAgent.AgentConfig.UseEnvVar = false;

                AzureEnvironment environment = Utility.GetTargetEnvironment();
                managementClient = new ManagementClient(Utility.GetCertificateCloudCredential(),
                                                        environment.GetEndpointAsUri(AzureEnvironment.Endpoint.ServiceManagement));

                accountUtils = new AccountUtils(lang, isResourceMode);

                accountName = accountUtils.GenerateAccountName();

                resourceLocation  = isMooncake ? Constants.MCLocation.ChinaEast : allowedLocation;
                resourceManager   = new ResourceManagerWrapper();
                resourceGroupName = accountUtils.GenerateResourceGroupName();
                resourceManager.CreateResourceGroup(resourceGroupName, resourceLocation);

                var parameters = new SRPModel.StorageAccountCreateParameters(new SRPModel.Sku(SRPModel.SkuName.StandardGRS), SRPModel.Kind.StorageV2,
                                                                             isMooncake ? Constants.MCLocation.ChinaEast : allowedLocation);
                accountUtils.SRPStorageClient.StorageAccounts.CreateAsync(resourceGroupName, accountName, parameters, CancellationToken.None).Wait();

                //resourceGroupName = "weitest";
                //accountName = "weitesttemp";
            }
        }