private void SetupManagementClients(RestTestFramework.MockContext context)
        {
            if (HttpMockServer.Mode == HttpRecorderMode.Record)
            {
                // This allows the use of a particular subscription if the user is associated to several
                // "TEST_CSM_ORGID_AUTHENTICATION=SubscriptionId=<subscription-id>"
                string subId = Environment.GetEnvironmentVariable("TEST_CSM_ORGID_AUTHENTICATION");
                RestTestFramework.TestEnvironment environment = new RestTestFramework.TestEnvironment(connectionString: subId);
                this.MonitorManagementClient = this.GetInsightsManagementClient(context: context, env: environment);
                ResourceManagementClient     = this.GetResourceManagementClient(context: context, env: environment);
                StorageManagementClient      = this.GetStorageManagementClient(context: context, env: environment);
                ApplicationInsightsClient    = this.GetApplicationInsightsManagementClient(context: context, env: environment);
            }
            else if (HttpMockServer.Mode == HttpRecorderMode.Playback)
            {
                this.MonitorManagementClient = this.GetInsightsManagementClient(context: context, env: null);
                ResourceManagementClient     = this.GetResourceManagementClient(context: context, env: null);
                StorageManagementClient      = this.GetStorageManagementClient(context: context, env: null);
                ApplicationInsightsClient    = GetApplicationInsightsManagementClient(context, env: null);
            }

            _helper.SetupManagementClients(
                ResourceManagementClient,
                this.MonitorManagementClient,
                StorageManagementClient,
                this.ApplicationInsightsClient);
        }
Exemple #2
0
 private IMonitorManagementClient GetInsightsManagementClient(RestTestFramework.MockContext context, RestTestFramework.TestEnvironment env)
 {
     return(env != null
         ? context.GetServiceClient <MonitorManagementClient>(currentEnvironment : env)
         : context.GetServiceClient <MonitorManagementClient>());
 }
 private StorageManagementClient GetStorageManagementClient(RestTestFramework.MockContext context, RestTestFramework.TestEnvironment env)
 {
     return(env != null
         ? context.GetServiceClient <StorageManagementClient>(currentEnvironment : env)
         : context.GetServiceClient <StorageManagementClient>());
 }
 private IMonitorClient GetMonitorClient(RestTestFramework.MockContext context, RestTestFramework.TestEnvironment env)
 {
     // currentEnvironment: RestTestFramework.TestEnvironmentFactory.GetTestEnvironment());
     return(env != null
         ? context.GetServiceClient <MonitorClient>(currentEnvironment : env)
         : context.GetServiceClient <MonitorClient>());
 }
Exemple #5
0
 private AzureRestClient GetAzureRestClient(RestTestFramework.MockContext context, RestTestFramework.TestEnvironment env)
 {
     return(env != null
         ? context.GetServiceClient <AzureRestClient>(currentEnvironment : env)
         : context.GetServiceClient <AzureRestClient>());
 }