Exemplo n.º 1
0
        public static void Test()
        {
            IBehaviorProvider behaviorProvider = new AttributeBehaviorCollection()
                                                 .Add(typeof(LogAttribute), typeof(LogBehavior));

            ReflectionPipeline <ProductQueryHandler> pipeline     = new ReflectionPipeline <ProductQueryHandler>(behaviorProvider, new DefaultReflectionBehaviorFactory());
            IQueryHandler <ProductQuery, Product>    queryHandler = new BehaviorQueryHandler <ProductQueryHandler, ProductQuery, Product>(pipeline, new DefaultFactory <ProductQueryHandler>());

            Task <Product> task = queryHandler.HandleAsync(new ProductQuery()
            {
                Name = "Test"
            });

            if (!task.IsCompleted)
            {
                task.RunSynchronously();
            }

            Console.WriteLine(task.Result.Price);
        }
Exemplo n.º 2
0
 public void Setup()
 {
     BaseSetup();
     pipeline = new ReflectionPipeline(middlewareTypes, typeof(Message));
 }