public void AddsTraceIdLabel()
        {
            // Arrange
            var traceId = Guid.NewGuid().ToString();

            var mockHttpContext = new Mock <HttpContext>();

            mockHttpContext.Setup(x => x.TraceIdentifier).Returns(traceId);

            var mockHttpContextAccessor = new Mock <IHttpContextAccessor>();

            mockHttpContextAccessor.Setup(x => x.HttpContext).Returns(mockHttpContext.Object);

            var instance = new TraceIdLogEntryLabelProvider(mockHttpContextAccessor.Object);
            var labels   = new Dictionary <string, string>();

            // Act
            instance.Invoke(labels);

            // Assert
            Assert.Single(labels);
            var label = labels.Single();

            Assert.Equal("trace_identifier", label.Key);
            Assert.Equal(traceId, label.Value);
        }
        public void DoesNotAddWhenNoTraceId(string traceId)
        {
            // Arrange
            var mockHttpContext = new Mock <HttpContext>();

            mockHttpContext.Setup(x => x.TraceIdentifier).Returns(traceId);

            var mockHttpContextAccessor = new Mock <IHttpContextAccessor>();

            mockHttpContextAccessor.Setup(x => x.HttpContext).Returns(mockHttpContext.Object);

            var instance = new TraceIdLogEntryLabelProvider(mockHttpContextAccessor.Object);
            var labels   = new Dictionary <string, string>();

            // Act
            instance.Invoke(labels);

            // Assert
            Assert.Empty(labels);
        }