예제 #1
0
        public void Arrange()
        {
            var step1 = new FuncRouteProcessor
                            {
                                _CanProcess = r => r.Resource == "step1",
                                _Process = r => _result = new EndRouteResult(r)
                            };
            var step2 = new FuncRouteProcessor
                            {
                                _CanProcess = r => r.Resource == "step2",
                                _Process = r => _result = new EndRouteResult(r)
                            };

            _engine = new RoutingEngine();
            _engine.AddProcessor(step1);
            _engine.AddProcessor(step2);
        }
        public void Setup()
        {
            var route = "do step1".ToRoute();

            var step1a = new FuncRouteProcessor
                             {
                                 _CanProcess = r => r.Resource == "step1",
                                 _Process = r => _resultA = new EndRouteResult(r)
                             };
            var step1b = new FuncRouteProcessor
                             {
                                 _CanProcess = r => r.Resource == "step1",
                                 _Process = r => _resultB = new EndRouteResult(r)
                             };

            var engine = new RoutingEngine();
            engine.AddProcessor(step1a);
            engine.AddProcessor(step1b);

            engine.Process(route);
        }
예제 #3
0
        public void Setup()
        {
            _route1 = "do step1".ToRoute();
            _route2 = "do step2".ToRoute();

            var step1 = new FuncRouteProcessor
                            {
                                _CanProcess = r => r.Resource == "step1",
                                _Process = r => new RouteResult(r).Next(_route2)
                            };

            var step2 = new FuncRouteProcessor
                            {
                                _CanProcess = r => r.Resource == "step2",
                                _Process = r => _result = new EndRouteResult(r)
                            };

            var engine = new RoutingEngine();
            engine.AddProcessor(step1);
            engine.AddProcessor(step2);
            engine.Process(_route1);
        }