public void MatchesRpcRoute_DifferentRoutes_Valid(string requestUrl, string availableRouteName, bool shouldMatch) { IRpcRouteProvider routeProvider = new FakeRouteProvider(); RouteCriteria routeCriteria = new RouteCriteria(typeof(ParserTests)); routeProvider.RegisterRoute(routeCriteria, availableRouteName); DefaultRpcParser parser = new DefaultRpcParser(null); RpcRoute matchedRoute; bool isMatch = parser.MatchesRpcRoute(routeProvider, requestUrl, out matchedRoute); Assert.Equal(isMatch, shouldMatch); Assert.Equal(matchedRoute != null, shouldMatch); }
public void MatchesRpcRoute_DifferentRoutes_Valid(string requestUrl, string availableRouteName, bool shouldMatch) { RpcRoute route = new RpcRoute(availableRouteName); RpcRouteCollection routes = new RpcRouteCollection { route }; DefaultRpcParser parser = new DefaultRpcParser(); RpcRoute matchedRoute; bool isMatch = parser.MatchesRpcRoute(routes, requestUrl, out matchedRoute); Assert.Equal(isMatch, shouldMatch); Assert.Equal(matchedRoute != null, shouldMatch); Assert.Equal(route == matchedRoute, shouldMatch); }
public void RpcRouteWithBaseRoute_NoBaseRoute_Failure() { IRpcRouteProvider routeProvider = new FakeRouteProvider(); routeProvider.BaseRequestPath = "Base"; RouteCriteria routeCriteria = new RouteCriteria(typeof(ParserTests)); routeProvider.RegisterRoute(routeCriteria, "Test"); DefaultRpcParser parser = new DefaultRpcParser(null); RpcRoute matchedRoute; bool isMatch = parser.MatchesRpcRoute(routeProvider, "/Test", out matchedRoute); Assert.False(isMatch); Assert.Null(matchedRoute); }