예제 #1
0
        public void NullFilter()
        {
            var source = Rand.Array <DummyEntity>();

            new TestCaseRunner()
            .Run(() => FilterMiddleware <DummyContext, DummyEntity> .NullFilter(source))
            .Verify(source, (Type)null);
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddSingleton(_ => Configuration);
            services.AddMvc();

            Func <IBotContext, bool> lengthPredicate = (context) =>
            {
                return(context.Request.Type == "message" && context.Request.AsMessageActivity().Text != null && context.Request.AsMessageActivity().Text.Length < 5);
            };


            services.AddSingleton <BotFrameworkAdapter>(_ =>
            {
                return(new BotFrameworkAdapter(Configuration)
                       .Use(FilterMiddleware.Filter(lengthPredicate, new TestMiddleware())));
            });
        }