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_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_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");
        }
Exemple #5
0
        public async Task Should_Not_Substitue_Existing_Operation_Id_If_Context_Contains_Null()
        {
            using (new OperationContextScope("opid", "parentid"))
            {
                var context = new MockOwinContext();

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

                await sut.Invoke(context);

                collector.OperationIdFromAmbientContext.Should().Be("opid");
                collector.ParentOperationIdFromAmbientContext.Should().Be("parentid");
            }
        }