public void DifferentSegmentCountsShouldNotMatch()
        {
            var segment = MockRepository.GenerateStrictMock<IPathSegment>();
            var segments = Enumerable.Repeat(segment, 2).ToList();

            var path = MockRepository.GenerateStrictMock<IPath>();
            path.Expect(p => p.FullPath).Return("/first/second");
            path.Expect(p => p.Segments).Return(segments);

            var routeSegment = MockRepository.GenerateStrictMock<IPathSegment>();
            var routeSegments = Enumerable.Repeat(routeSegment, 1).ToList();

            var routePath = MockRepository.GenerateStrictMock<IPath>();
            routePath.Expect(r => r.IsCapture).Return(true);
            routePath.Expect(r => r.LiteralPath).Return("/first/");
            routePath.Expect(r => r.Segments).Return(routeSegments);
            var route = MockRepository.GenerateStrictMock<IRoute>();
            route.Expect(r => r.Path).Return(routePath);

            var predicate = new CaptureRankedRoutePredicate();

            var match = predicate.Matches(route, path);

            Assert.IsFalse(match);
        }
        public void LiteralRoutesShouldNotMatch()
        {
            var path = MockRepository.GenerateStrictMock<IPath>();

            var routePath = MockRepository.GenerateStrictMock<IPath>();
            routePath.Expect(r => r.IsCapture).Return(false);
            var route = MockRepository.GenerateStrictMock<IRoute>();
            route.Expect(r => r.Path).Return(routePath);

            var predicate = new CaptureRankedRoutePredicate();

            var match = predicate.Matches(route, path);

            Assert.IsFalse(match);
        }
        public void DifferentLiteralSectionsShouldNotMatch()
        {
            var path = MockRepository.GenerateStrictMock<IPath>();
            path.Expect(p => p.FullPath).Return("/first/second");

            var routePath = MockRepository.GenerateStrictMock<IPath>();
            routePath.Expect(r => r.IsCapture).Return(true);
            routePath.Expect(r => r.LiteralPath).Return("/second/{third}");
            var route = MockRepository.GenerateStrictMock<IRoute>();
            route.Expect(r => r.Path).Return(routePath);

            var predicate = new CaptureRankedRoutePredicate();

            var match = predicate.Matches(route, path);

            Assert.IsFalse(match);
        }
        public void PathTests()
        {
            var routePath = new PathBuilder("/first/{capture}");

            var route = new Route(routePath, null);

            var predicate = new CaptureRankedRoutePredicate();

            Assert.IsTrue(predicate.Matches(route, new PathBuilder("/first/1").Build()));
            Assert.IsTrue(predicate.Matches(route, new PathBuilder("/first/test").Build()));
            Assert.IsFalse(predicate.Matches(route, new PathBuilder("/first").Build()));
            Assert.IsFalse(predicate.Matches(route, new PathBuilder("/first/").Build()));
        }