public void EnsureAllRoutesAreRegisteredTest()
 {
     foreach (var routePathItem in TodoController.GetRoutePaths)
     {
         var key = RouteKeys.CreateActionKey(routePathItem.Value);
         Assert.True(_routeProvider.RouteMap.ContainsKey(key));
     }
 }
    public static void CreateAndRegisterRoutes(IChromelyRouteProvider routeProvider, ChromelyController controller, IChromelyModelBinder routeParameterBinder, IChromelyDataTransferOptions dataTransferOptions)
    {
        if (routeProvider is null || controller is null)
        {
            return;
        }

        var methodInfos = controller.GetType().GetMethods()
                          .Where(m => m.GetCustomAttributes(typeof(ChromelyRouteAttribute), false).Length > 0)
                          .ToArray();

        foreach (var methodInfo in methodInfos)
        {
            var attribute = methodInfo.GetCustomAttribute <ChromelyRouteAttribute>();
            var key       = RouteKeys.CreateActionKey(controller.RoutePath, attribute?.Path ?? string.Empty);
            if (!routeProvider.RouteExists(key))
            {
                routeProvider.RegisterRoute(key, ControllerRoutesFactory.CreateDelegate(controller, methodInfo, routeParameterBinder, dataTransferOptions));
            }
        }
    }