public void AddPath_Different_NoMatch() { RpcPath fullPath = RpcPath.Parse("/Base/Test"); RpcPath otherPath = fullPath.Add(RpcPath.Parse("/Test")); Assert.NotEqual(fullPath, otherPath); }
public bool MatchesRpcRoute(RpcRouteCollection routes, string requestUrl, out RpcRoute route) { if (routes == null) { throw new ArgumentNullException(nameof(routes)); } if (requestUrl == null) { throw new ArgumentNullException(nameof(requestUrl)); } this.Logger?.LogVerbose($"Attempting to match Rpc route for the request url '{requestUrl}'"); RpcPath requestPath = RpcPath.Parse(requestUrl); RpcPath routePrefix = RpcPath.Parse(routes.RoutePrefix); foreach (RpcRoute rpcRoute in routes) { RpcPath routePath = RpcPath.Parse(rpcRoute.Name); routePath = routePrefix.Add(routePath); if (requestPath == routePath) { this.Logger?.LogVerbose($"Matched the request url '{requestUrl}' to the route '{rpcRoute.Name}'"); route = rpcRoute; return(true); } } this.Logger?.LogVerbose($"Failed to match the request url '{requestUrl}' to a route"); route = null; return(false); }