public void OnResultExecuting(ResultExecutingContext context)
 {
     context.Cancel = true;
     Assert.IsNotNull(context.ControllerContext);
     Assert.IsNotNull(context.Request);
     Assert.IsNotNull(context.Request.RouteValues);
 }
Esempio n. 2
0
        /// <summary>
        /// Invokes all pre-result filters, before the result has been invoked.
        /// </summary>
        /// <param name="controllerContext">The controller context.</param>
        /// <param name="result">The result.</param>
        /// <param name="resultFilters">The result filters.</param>
        /// <returns></returns>
        protected virtual ResultExecutingContext ExecutePreResultFilters(ControllerContext controllerContext, ActionResult result, IEnumerable<IResultFilter> resultFilters)
        {
            controllerContext.Request.ReportProgress(new PreResultFiltersNavigationEvent());

            var context = new ResultExecutingContext(controllerContext, result);
            foreach (var filter in resultFilters)
            {
                filter.OnResultExecuting(context);
                if (context.Cancel)
                {
                    return context;
                }
            }
            return context;
        }