public void GetNext()
        {
            // Arrange
            var fixture      = new Fixture();
            var traceId      = Convert.ToString(fixture.Create <long>(), 16);
            var spanId       = Convert.ToString(fixture.Create <long>(), 16);
            var parentSpanId = Convert.ToString(fixture.Create <long>(), 16);
            var isSampled    = fixture.Create <bool>();

            var context = GenerateContext(
                traceId,
                spanId,
                parentSpanId,
                isSampled.ToString());

            var sut = new TraceProvider(new ZipkinConfig(), context);

            // Act
            var nextTraceProvider = sut.GetNext();

            // Assert
            Assert.AreEqual(sut.TraceId, nextTraceProvider.TraceId);
            Assert.IsTrue(Regex.IsMatch(nextTraceProvider.SpanId, regex64BitPattern));
            Assert.AreEqual(sut.SpanId, nextTraceProvider.ParentSpanId);
            Assert.AreEqual(sut.IsSampled, nextTraceProvider.IsSampled);
        }
        public void GetNext()
        {
            // Arrange
            var fixture      = new Fixture();
            var traceId      = Convert.ToString(fixture.Create <long>(), 16);
            var spanId       = Convert.ToString(fixture.Create <long>(), 16);
            var parentSpanId = Convert.ToString(fixture.Create <long>(), 16);
            var isSampled    = fixture.Create <bool>();

            var context = MockRepository.GenerateStub <IOwinContext>();
            var request = MockRepository.GenerateStub <IOwinRequest>();
            var headers = new HeaderDictionary(new Dictionary <string, string[]>
            {
                { TraceProvider.TraceIdHeaderName, new [] { traceId } },
                { TraceProvider.SpanIdHeaderName, new [] { spanId } },
                { TraceProvider.ParentSpanIdHeaderName, new [] { parentSpanId } },
                { TraceProvider.SampledHeaderName, new [] { isSampled.ToString() } }
            });
            var environment = new Dictionary <string, object>();

            request.Stub(x => x.Headers).Return(headers);
            context.Stub(x => x.Request).Return(request);
            context.Stub(x => x.Environment).Return(environment);

            var sut = new TraceProvider(new ZipkinConfig(), context);

            // Act
            var nextTraceProvider = sut.GetNext();

            // Assert
            Assert.AreEqual(sut.TraceId, nextTraceProvider.TraceId);
            Assert.AreEqual(sut.SpanId, nextTraceProvider.ParentSpanId);
            Assert.AreEqual(sut.IsSampled, nextTraceProvider.IsSampled);
        }