public async void Invoke_CreatesContext_ThenDisposes()
        {
            RequestDelegate del = (ctx) => {
                Assert.True(HystrixRequestContext.IsCurrentThreadInitialized);
                return(Task.FromResult <int>(1));
            };
            var         reqContext = new HystrixRequestContextMiddleware(del);
            HttpContext context    = new DefaultHttpContext();
            await reqContext.Invoke(context);

            Assert.False(HystrixRequestContext.IsCurrentThreadInitialized);
        }
        public void HystrixRequestContextMiddleware_RegistersStoppingAction()
        {
            RequestDelegate del = (ctx) =>
            {
                Assert.True(HystrixRequestContext.IsCurrentThreadInitialized);
                return(Task.FromResult <int>(1));
            };
            var life       = new TestLifecyecle();
            var reqContext = new HystrixRequestContextMiddleware(del, life);

            Assert.True(life.Registered);
            life.StopApplication();
        }