상속: Microsoft.Owin.OwinMiddleware
        public async Task Can_Restore_Operation_Context_Id_From_Owin_Context()
        {
            var context = new MockOwinContext();
            context.Set(Consts.OperationIdContextKey, "test");

            var collector = new OperationIdCollectingMiddleware();
            var sut = new RestoreOperationIdContextMiddleware(collector);

            await sut.Invoke(context);

            collector.OperationIdFromAmbientContext.Should().Be("test");
        }
        public async Task Should_Not_Substitue_Existing_Operation_Id_If_Context_Contains_Null()
        {
            OperationIdContext.Set("test");
            var context = new MockOwinContext();

            var collector = new OperationIdCollectingMiddleware();
            var sut = new RestoreOperationIdContextMiddleware(collector);

            await sut.Invoke(context);

            collector.OperationIdFromAmbientContext.Should().Be("test");
        }
        public async Task Can_Establish_Id_Context()
        {
            var actual = new OperationIdCollectingMiddleware();

            var sut = new OperationIdContextMiddleware(
                actual,
                new OperationIdContextMiddlewareConfiguration());

            await sut.Invoke(new MockOwinContext());

            actual.OperationIdFromAmbientContext.Should().NotBeNullOrEmpty();
            actual.OperationIdFromAmbientContext.Should()
                .Be(actual.OperationIdFromEnvironment);
        }