public void SaveInvokeTest() { BaseTest(); string routeKey = RouteKey.CreateRequestKey("/testcontroller/movies"); var routeSave = _requestActionRouteDictionary[routeKey]; Assert.NotNull(routeSave); var parameter = DateTime.Now.ToString(CultureInfo.InvariantCulture); var response = routeSave.Invoke(new ChromelyRequest("/testcontroller/movies", null, parameter)); Assert.NotNull(response); Assert.True(response.Data is string); Assert.Equal(parameter, (string)response.Data); }
public void Get1InvokeTest() { BaseTest(); string routeKey = RouteKey.CreateRequestKey("/testcontroller/movies/1"); var routeGet1 = _requestActionRouteDictionary[routeKey]; Assert.NotNull(routeGet1); var response = routeGet1.Invoke(new ChromelyRequest("/testcontroller/movies/1", null, null)); Assert.NotNull(response); Assert.True(response.Data is int); Assert.Equal(1000, (int)response.Data); }
public void Get2InvokeTest() { BaseTest(); string routeKey = RouteKey.CreateRequestKey("/testcontroller/movies/2"); var routeGet2 = _requestActionRouteDictionary[routeKey]; Assert.NotNull(routeGet2); IChromelyResponse response = routeGet2.Invoke(new ChromelyRequest("/testcontroller/movies/2", null, null)); Assert.NotNull(response); Assert.True(response.Data is string); Assert.Equal("Test Get 2", (string)response.Data); }
public virtual RequestActionRoute GetActionRoute(string routeUrl) { var key = RouteKey.CreateRequestKey(routeUrl); if (string.IsNullOrWhiteSpace(key)) { return(null); } EnsureContainersAreInitialized(); if (ActionRouteDictionary.ContainsKey(key)) { return(ActionRouteDictionary[key]); } return(null); }