public void CompileDelegate()
        {
            // arrange
            MiddlewareFactory <CustomClassMiddleware, IServiceProvider, CustomDelegate> factory =
                MiddlewareCompiler <CustomClassMiddleware>
                .CompileFactory <IServiceProvider, CustomDelegate>(
                    (services, next) =>
                    new List <IParameterHandler>
            {
                new TypeParameterHandler(typeof(string), Expression.Constant("abc")),
                new ServiceParameterHandler(services)
            });

            CustomClassMiddleware middleware =
                factory.Invoke(new EmptyServiceProvider(), c => default);

            // act
            ClassQueryDelegate <CustomClassMiddleware, CustomContext> pipeline =
                MiddlewareCompiler <CustomClassMiddleware> .CompileDelegate <CustomContext>(
                    (context, middleware) =>
                    new List <IParameterHandler>
            {
                new TypeParameterHandler(typeof(string), Expression.Constant("def"))
            });

            // assert
            var context = new CustomContext(new EmptyServiceProvider());

            pipeline.Invoke(context, middleware);
            Assert.Equal("abcdef", context.Result);
        }
        public void CompileFactory()
        {
            // arrange
            // act
            MiddlewareFactory <CustomClassMiddleware, IServiceProvider, CustomDelegate> factory =
                MiddlewareCompiler <CustomClassMiddleware>
                .CompileFactory <IServiceProvider, CustomDelegate>(
                    (services, next) =>
                    new List <IParameterHandler>
            {
                new TypeParameterHandler(typeof(string), Expression.Constant("abc")),
                new ServiceParameterHandler(services)
            });

            // assert
            CustomClassMiddleware middleware =
                factory.Invoke(new EmptyServiceProvider(), c => default);

            Assert.Equal("abc", middleware.Some);
        }