public void EnvoyPropagatorShouldDecodeABinaryContextFromString()
        {
            UInt64 traceId = 4952807665017200957;
            UInt64 spanId  = 14848807816610383171;

            var base64Context = "EhQJQwUbbwmQEc4RPaEuilTou0QYAQ==";
            var bs            = Convert.FromBase64String(base64Context);

            var envoyPropagator = new EnvoyPropagator();
            var streamCarrier   = new MemoryStream(bs);

            var extractedContext = envoyPropagator.Extract(BuiltinFormats.Binary, new BinaryExtractAdapter(streamCarrier));

            Assert.NotNull(extractedContext);
            Assert.Equal(traceId, extractedContext.SpanIdValue);
            Assert.Equal(spanId, extractedContext.TraceIdValue);

            var reStreamCarrier = new MemoryStream();

            envoyPropagator.Inject(extractedContext, BuiltinFormats.Binary, new BinaryInjectAdapter(reStreamCarrier));
            var reBase64String = Convert.ToBase64String(reStreamCarrier.ToArray());

            Assert.NotNull(reStreamCarrier);
            Assert.Equal(base64Context, reBase64String);
        }
        public void EnvoyPropagatorShouldEncodeASpanContext()
        {
            var ctx             = new SpanContext(1, 1);
            var envoyPropagator = new EnvoyPropagator();
            var carrierStream   = new MemoryStream();

            envoyPropagator.Inject(ctx, BuiltinFormats.Binary, new BinaryInjectAdapter(carrierStream));

            Assert.NotNull(carrierStream);
            Assert.True(carrierStream.Length > 0);

            var extractedContext =
                envoyPropagator.Extract(BuiltinFormats.Binary, new BinaryExtractAdapter(carrierStream));

            Assert.NotNull(extractedContext);
            Assert.Equal("1", extractedContext.SpanId);
            Assert.Equal("1", extractedContext.TraceId);
        }