public IActionResult Index() { RoutingService routingService = new RoutingService(); routingService.Route(CreateEnterpriseData()); return(View()); }
/// <summary> /// Process a request. /// </summary> /// <param name="context">Request information</param> /// <returns>What to do next.</returns> public ProcessingResult Process(RequestContext context) { _current = this; var routingContext = new RoutingContext(context.Request); var routeResult = RoutingService.Route(routingContext); if (routeResult == null) { return(ProcessingResult.Continue); } var controllerContext = new ControllerContext(context) { ActionName = routeResult.ActionName, ControllerUri = routeResult.ControllerUri }; var result = _factory.Invoke(routeResult.ControllerType, routeResult.Action, controllerContext); var viewData = result as IViewData; if (viewData != null) { _logger.Trace("Rendering action " + controllerContext.ActionName); RenderView(controllerContext, viewData); } else { var action = result as IActionResult; if (action != null) { ProcessingResult processingResult = _actionProvider.Invoke(context, action); if (processingResult == ProcessingResult.Abort) { return(processingResult); } } } return(ProcessingResult.SendResponse); }
public async Task Route_PayloadIsEmpty_ArgumentException() { // Act-Assert await Assert.ThrowsAsync <ArgumentException>(() => _service.Route(string.Empty)); }