public void ShouldReturnTheCurrentTraceHeader(
                string id,
                [Frozen, Substitute] ITracingIdService tracingIdService,
                [Target] AwsXRayTracingService service
                )
            {
                tracingIdService.CreateId().Returns(id);
                tracingIdService.GetIdFromHeader(Any <string?>()).Returns(null as string);

                service.StartTrace();
                service.Header.Should().Be($"Root={id}; Sampled=1");
            }
            public void ShouldStopTraceWhenContextIsDisposed(
                string header,
                string parentId,
                string traceId,
                [Frozen, Substitute] ITracingIdService tracingIdService,
                [Frozen, Substitute] IAWSXRayRecorder recorder,
                [Target] AwsXRayTracingService service
                )
            {
                tracingIdService.CreateId().Returns(traceId);
                tracingIdService.GetIdFromHeader(Is(header)).Returns(parentId);

                using (var context = service.StartTrace(header))
                {
                }

                recorder.Received().EndSegment();
            }
            public void ShouldStartSegmentWithNewId(
                string traceId,
                [Frozen, Substitute] ITracingIdService tracingIdService,
                [Frozen, Substitute] IAWSXRayRecorder recorder,
                [Target] AwsXRayTracingService service
                )
            {
                tracingIdService.CreateId().Returns(traceId);
                tracingIdService.GetIdFromHeader(Any <string>()).Returns(null as string);

                service.StartTrace();

                recorder.Received().BeginSegment(
                    name: Is(AwsXRayTracingService.ServiceName),
                    traceId: Is(traceId),
                    parentId: Is(null as string),
                    samplingResponse: Is <SamplingResponse>(response => response.SampleDecision == SampleDecision.Sampled)
                    );
            }