ploeh/Hyprlinkr — pull request #2 by dhilgarth (2012-10-01 20:09:16+00:00)
Title: Implemented ParseUri

Please see discussion on Issue 1: https://github.com/ploeh/Hyprlinkr/issues/1
I implemented three methods:
1. `ParseUri`: Parses an Uri into an `HttpActionContext`. This includes all the information about which action gets called on which controller as well as the parameters for the action method
2. `TryParseUri`
3: `Verify`: Verifies that an `HttpActionContext` indeed points to the action specified by an expression.

Some notes about Postel's law:
1. Over-parametrization in the URI is not a problem
2. Order of query parameters is irrelevant in the URI
3. Optional parameters can be missing in the URI
4. Permanent redirect routes are followed. This means that old links are verified successfully, if the rest of the application also supports those old links. A `RedirectRouteHandler` can be used to achieve this. See `Ploeh.Hyprlinkr.UnitTest.RedirectRouteHandler` for an implementation.

Some more notes:
1. I am not really happy with the names of the interfaces and the class. Suggestions for better names are welcome.
2. I am not really happy with the fact that `ParseUri` throws a generic `ArgumentException` if an error occurrs. I am also not happy with the way `ResourceLinkVerifier.GetActionDescriptor` is implemented. Maybe it would be a better idea to switch the implementation around? Make `TryParseUri` call `ParseUri`, put that call in a try-catch block and return `false` if an exception is caught. Still smells... Suggestions are welcome.