public void HandleRequest_SendsRequestToFirstMatchingRoute()
        {
            var routes = new List<IRoute>
                         {
                             MockRepository.GenerateStub<IRoute>(),
                             MockRepository.GenerateStub<IRoute>(),
                             MockRepository.GenerateStub<IRoute>()
                         };

            routes[0].Stub(x => x.IsMatch("/test.html")).Return(false);
            routes[1].Stub(x => x.IsMatch("/test.html")).Return(true);
            routes[2].Stub(x => x.IsMatch("/test.html")).Return(true);

            var context = Mocked.HttpContext()
                .WithUrl("http://localhost/test.html")
                .Mock;

            context.Stub(x => x.ServerInfo).Return(MockRepository.GenerateStub<IServerInfo>());
            context.ServerInfo.Stub(x => x.Routes).Return(routes);

            var handler = new RouteRequestHandler();
            handler.HandleRequest(context);

            routes[1].AssertWasCalled(x => x.HandleRequest(context));
        }
        public void HandleRequest_WithNoMatchingRoute_ReturnsFalse()
        {
            var routes = new List<IRoute> {MockRepository.GenerateStub<IRoute>()};
            
            var context = Mocked.HttpContext()
                .WithUrl("http://localhost/test.html")
                .Mock;

            context.Stub(x => x.ServerInfo).Return(MockRepository.GenerateStub<IServerInfo>());
            context.ServerInfo.Stub(x => x.Routes).Return(routes);
            
            var handler = new RouteRequestHandler();
            var result = handler.HandleRequest(context);

            Assert.False(result);
        }