public void CreateFilingTarget_ThrowsIfTelemetryIsNull()
        {
            ApplicationInsightsTelemetryInitializer initializer = new ApplicationInsightsTelemetryInitializer();

            Action action = () => initializer.Initialize(null);

            action.Should().Throw <ArgumentNullException>();
        }
        public void CreateFilingTarget_OperationIdShouldNotBeOverwritten()
        {
            TraceTelemetry telemetry = new TraceTelemetry();
            ApplicationInsightsTelemetryInitializer initializer = new ApplicationInsightsTelemetryInitializer();

            const string operationId = "abcd";

            telemetry.Context.Operation.Id = operationId;

            initializer.Initialize(telemetry);
            telemetry.Context.Operation.Id.Should().NotBeNull();
            telemetry.Context.Operation.Id.Should().Be(operationId);
        }
        public void CreateFilingTarget_OperationIdIsSet()
        {
            TraceTelemetry telemetry = new TraceTelemetry();
            ApplicationInsightsTelemetryInitializer initializer = new ApplicationInsightsTelemetryInitializer();

            telemetry.Context.Operation.Id.Should().BeNull();

            // After initialization, the operation_Id should be set to a GUID.
            initializer.Initialize(telemetry);
            telemetry.Context.Operation.Id.Should().NotBeNull();
            Guid.TryParse(telemetry.Context.Operation.Id, out Guid temp).Should().BeTrue();

            // A second telemetry item should be assigned the same operation_Id
            TraceTelemetry telemetry2 = new TraceTelemetry();

            initializer.Initialize(telemetry2);
            telemetry.Context.Operation.Id.Should().Be(telemetry2.Context.Operation.Id);
        }