Purpose: to verify that the given url returns the specified controller function.
In the process, I broke into the routing system, and I canβt understand how to test the routes (or, for that matter, find the controller that matches the route: - /).
Example code that does not work:
[Test] public void kick_the_tires() { var rc = new RouteCollection(); Infrastructure.RouteRegistry.RegisterRoutes(rc);
edit: using a related blog post from Simon for the stub class.
[TestCase("/", "~/", "Home", "Index")] [TestCase("/", "api/command", "Other", "command")] internal void stub_mocker(string apppath, string route, string expected_controller,\ string expected_action) { var rc = new RouteCollection(); Infrastructure.RouteRegistry.RegisterRoutes(rc); var httpmock = new StubHttpContextForRouting( appPath: apppath, requestUrl: route);
source share