static private SetCorrelationContextForWebRequest ( Microsoft.ApplicationInsights.DataContracts.DependencyTelemetry dependencyTelemetry, |
||
dependencyTelemetry | Microsoft.ApplicationInsights.DataContracts.DependencyTelemetry | Dependency telemetry item. |
webRequest | Http web request. | |
return | void |
public void SetCorrelationContextForWebRequestSetsHeaders() { var webRequest = WebRequest.Create(new Uri("http://bing.com")); var telemetry = new DependencyTelemetry(); telemetry.Id = "Id"; telemetry.Context.Operation.Id = "RootId"; WebRequestDependencyTrackingHelpers.SetCorrelationContextForWebRequest(telemetry, webRequest); var rootId = webRequest.Headers[RequestResponseHeaders.StandardRootIdHeader]; var operationId = webRequest.Headers[RequestResponseHeaders.StandardParentIdHeader]; Assert.AreEqual("RootId", rootId); Assert.AreEqual("Id", operationId); }
public void SetCorrelationContextForWebRequestDoesNotFailWithNullWebRequest() { var telemetry = new DependencyTelemetry(); WebRequestDependencyTrackingHelpers.SetCorrelationContextForWebRequest(telemetry, null); }
public void SetCorrelationContextForWebRequestFailsWithNullTelemetry() { var webRequest = WebRequest.Create(new Uri("http://bing.com")); WebRequestDependencyTrackingHelpers.SetCorrelationContextForWebRequest(null, webRequest); }