Beispiel #1
0
 public T InstrumentClientOptions <T>(T clientOptions) where T : ClientOptions
 {
     clientOptions.Transport = Recording.CreateTransport(clientOptions.Transport);
     if (Mode == RecordedTestMode.Playback)
     {
         // Not making the timeout zero so retry code still goes async
         clientOptions.Retry.Delay = TimeSpan.FromMilliseconds(10);
         clientOptions.Retry.Mode  = RetryMode.Fixed;
     }
     return(clientOptions);
 }
Beispiel #2
0
        /// <summary>
        /// Get an instance of <see cref="ApplicationInsightsDataClient"/> which can be used to query telemetry.
        /// See also: (https://dev.applicationinsights.io/documentation/Tools/CSharp-Sdk).
        /// </summary>
        /// <remarks>
        /// Alternatively for manual testing, can supply an Application Insights API Key.
        /// (https://dev.applicationinsights.io/documentation/Authorization/API-key-and-App-ID).
        /// <code>var creds = new ApiKeyClientCredentials("00000000-0000-0000-0000-000000000000");</code>
        /// </remarks>
        protected async Task <ApplicationInsightsDataClient> GetApplicationInsightsDataClientAsync()
        {
            var creds = await TestEnvironment.GetServiceClientCredentialsAsync();

            var handler    = new HttpPipelineMessageHandler(new HttpPipeline(Recording.CreateTransport(new HttpClientTransport())));
            var httpClient = new HttpClient(handler);

            var client = new ApplicationInsightsDataClient(credentials: creds, httpClient: httpClient, disposeHttpClient: true);

            return(client);
        }
 public T InstrumentClientOptions <T>(T clientOptions) where T : HttpClientOptions
 {
     clientOptions.Transport = Recording.CreateTransport(clientOptions.Transport);
     return(clientOptions);
 }