private static void UseMvc(HttpServerSimulator server, IMvcApplication mvcApplication)
        {
            SimulatorHelper.InitializeMembership();

            server.Use(httpContext =>
            {
                var action = new HttpControllerAction(mvcApplication, httpContext);
                var executionContext = action.GetExecutionContext();

                if (executionContext != null)
                {
                    var actionResult = action.GetAuthorizationResult(executionContext);

                    if (actionResult == null)
                    {
                        action.ValidateRequest(executionContext);
                        actionResult = action.GetActionResult(executionContext);
                    }

                    actionResult.ExecuteResult(executionContext.ControllerContext);
                    return true;
                }

                return false;
            });
        }
Esempio n. 2
0
 public virtual void StartServer()
 {
     _baseUrl = String.Format("http://localhost:{0}/", _port++);
     Server   = new HttpServerSimulator(_baseUrl);
 }