public void InitializeDoesNotThrowIfRequestTelemetryIsUnavailable()
        {
            var ac = new HttpContextAccessor() { HttpContext = new DefaultHttpContext() };

            var initializer = new OperationIdTelemetryInitializer(ac);

            initializer.Initialize(new RequestTelemetry());
        }
        public void InitializeSetsTelemetryOperationIdToRequestId()
        {
            var telemetry = new EventTelemetry();
            var requestTelemetry = new RequestTelemetry();
            var contextAccessor = HttpContextAccessorHelper.CreateHttpContextAccessor(requestTelemetry);

            var initializer = new OperationIdTelemetryInitializer(contextAccessor);

            initializer.Initialize(telemetry);

            Assert.Equal(requestTelemetry.Id, telemetry.Context.Operation.Id);
        }
        public void InitializeDoesNotOverrideOperationIdProvidedInline()
        {
            var telemetry = new EventTelemetry();
            telemetry.Context.Operation.Id = "123";
            var contextAccessor = HttpContextAccessorHelper.CreateHttpContextAccessor();

            var initializer = new OperationIdTelemetryInitializer(contextAccessor);

            initializer.Initialize(telemetry);

            Assert.Equal("123", telemetry.Context.Operation.Id);
        }