예제 #1
0
        public void FirstTestName()
        {
            var route = new RouteNode <Uri>(new StubRoute <Uri>());

            var joinNode = new JoinNode <Uri>(_id++, new ConstantNode <Uri>());

            joinNode.Add(route);

            var alpha = new AlphaNode <Uri>(_id++);

            alpha.Add(joinNode);

            var equal = new EqualNode <Uri>(() => _id++);

            equal.Add("version", alpha);

            var segment = new SegmentNode <Uri>(1);

            segment.Add(equal);

            var engine = new MagnumRoutingEngine <Uri>(x => x);

            engine.Match <RootNode <Uri> >().Single().Add(segment);

            bool called = false;

            var uri = new Uri("http://localhost/version");

            engine.Route(uri, x =>
            {
                called = true;
            });

            called.ShouldBeTrue();
        }
예제 #2
0
		public void FirstTestName()
		{
			var route = new RouteNode<Uri>(new StubRoute<Uri>());

			var joinNode = new JoinNode<Uri>(_id++, new ConstantNode<Uri>());
			joinNode.Add(route);

			var alpha = new AlphaNode<Uri>(_id++);
			alpha.Add(joinNode);

			var equal = new EqualNode<Uri>(() => _id++);
			equal.Add("version", alpha);

			var segment = new SegmentNode<Uri>(1);
			segment.Add(equal);

			var engine = new MagnumRoutingEngine<Uri>(x => x);
			engine.Match<RootNode<Uri>>().Single().Add(segment);

			bool called = false;

			var uri = new Uri("http://localhost/version");
			engine.Route(uri, x =>
				{
					called = true;
				});

			called.ShouldBeTrue();
		}
예제 #3
0
		public RoutingEngineRoutingRunner()
		{
			_idGenerator = new SequentialNodeIdGenerator();

			_engine = new MagnumRoutingEngine<Uri>(x => x);

			_segment = new SegmentNode<Uri>(1);
			_engine.Match<RootNode<Uri>>().Single().Add(_segment);

			_equal = new EqualNode<Uri>(() => _id++);
			_segment.Add(_equal);
		}
예제 #4
0
		public void Given_an_existing_segment_condition()
		{
			_engine = new MagnumRoutingEngine<Uri>(x => x);

			var segmentNode = new SegmentNode<Uri>(1);
			var equals = new EqualNode<Uri>(() => _id++);
			equals.Add("version", new AlphaNode<Uri>(_id++));
			segmentNode.Add(equals);


			_engine.Add(segmentNode);
		}
예제 #5
0
        public RoutingEngineRoutingRunner()
        {
            _idGenerator = new SequentialNodeIdGenerator();

            _engine = new MagnumRoutingEngine <Uri>(x => x);

            _segment = new SegmentNode <Uri>(1);
            _engine.Match <RootNode <Uri> >().Single().Add(_segment);

            _equal = new EqualNode <Uri>(() => _id++);
            _segment.Add(_equal);
        }
예제 #6
0
        public void Given_an_existing_segment_condition()
        {
            _engine = new MagnumRoutingEngine <Uri>(x => x);

            var segmentNode = new SegmentNode <Uri>(1);
            var equals      = new EqualNode <Uri>(() => _id++);

            equals.Add("version", new AlphaNode <Uri>(_id++));
            segmentNode.Add(equals);


            _engine.Add(segmentNode);
        }