Issue #862 Extensibility for action invoker

This commit is contained in:
Ryan Nowak 2014-08-01 14:12:15 -07:00
parent ca7b1bfb1f
commit 3770906c3b
9 changed files with 165 additions and 138 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
@ -13,11 +13,8 @@ using Microsoft.Framework.DependencyInjection;
namespace Microsoft.AspNet.Mvc
{
public class ReflectedActionInvoker : IActionInvoker
public abstract class FilterActionInvoker : IActionInvoker
{
private readonly ActionContext _actionContext;
private readonly ReflectedActionDescriptor _descriptor;
private readonly IControllerFactory _controllerFactory;
private readonly IActionBindingContextProvider _bindingProvider;
private readonly INestedProviderManager<FilterProviderContext> _filterProvider;
@ -34,31 +31,22 @@ namespace Microsoft.AspNet.Mvc
private ResultExecutingContext _resultExecutingContext;
private ResultExecutedContext _resultExecutedContext;
public ReflectedActionInvoker([NotNull] ActionContext actionContext,
[NotNull] ReflectedActionDescriptor descriptor,
[NotNull] IControllerFactory controllerFactory,
[NotNull] IActionBindingContextProvider bindingContextProvider,
[NotNull] INestedProviderManager<FilterProviderContext> filterProvider)
public FilterActionInvoker(
[NotNull] ActionContext actionContext,
[NotNull] IActionBindingContextProvider bindingContextProvider,
[NotNull] INestedProviderManager<FilterProviderContext> filterProvider)
{
_actionContext = actionContext;
_descriptor = descriptor;
_controllerFactory = controllerFactory;
ActionContext = actionContext;
_bindingProvider = bindingContextProvider;
_filterProvider = filterProvider;
if (descriptor.MethodInfo == null)
{
throw new ArgumentException(
Resources.FormatPropertyOfTypeCannotBeNull("MethodInfo",
typeof(ReflectedActionDescriptor)),
"descriptor");
}
}
public async Task InvokeActionAsync()
{
_actionContext.Controller = _controllerFactory.CreateController(_actionContext);
protected ActionContext ActionContext { get; private set; }
protected abstract Task<IActionResult> InvokeActionAsync(ActionExecutingContext actionExecutingContext);
public virtual async Task InvokeAsync()
{
_filters = GetFilters();
_cursor = new FilterCursor(_filters);
@ -69,11 +57,11 @@ namespace Microsoft.AspNet.Mvc
// result filters around it.
if (_authorizationContext.Result != null)
{
await _authorizationContext.Result.ExecuteResultAsync(_actionContext);
await _authorizationContext.Result.ExecuteResultAsync(ActionContext);
}
else if (_exceptionContext.Result != null)
{
await _exceptionContext.Result.ExecuteResultAsync(_actionContext);
await _exceptionContext.Result.ExecuteResultAsync(ActionContext);
}
else if (_exceptionContext.Exception != null)
{
@ -96,41 +84,11 @@ namespace Microsoft.AspNet.Mvc
}
}
// Marking as internal for Unit Testing purposes.
internal static IActionResult CreateActionResult([NotNull] Type declaredReturnType, object actionReturnValue)
{
// optimize common path
var actionResult = actionReturnValue as IActionResult;
if (actionResult != null)
{
return actionResult;
}
if (declaredReturnType == typeof(void) ||
declaredReturnType == typeof(Task))
{
return new NoContentResult();
}
// Unwrap potential Task<T> types.
var actualReturnType = TypeHelper.GetTaskInnerTypeOrNull(declaredReturnType) ?? declaredReturnType;
if (actionReturnValue == null && typeof(IActionResult).IsAssignableFrom(actualReturnType))
{
throw new InvalidOperationException(
Resources.FormatActionResult_ActionReturnValueCannotBeNull(actualReturnType));
}
return new ObjectResult(actionReturnValue)
{
DeclaredType = actualReturnType
};
}
private IFilter[] GetFilters()
{
var filterProviderContext = new FilterProviderContext(
_actionContext,
_descriptor.FilterDescriptors.Select(fd => new FilterItem(fd)).ToList());
ActionContext,
ActionContext.ActionDescriptor.FilterDescriptors.Select(fd => new FilterItem(fd)).ToList());
_filterProvider.Invoke(filterProviderContext);
@ -183,7 +141,7 @@ namespace Microsoft.AspNet.Mvc
// 1) Call the filter (if we have an exception)
// 2) No-op (if we don't have an exception)
Contract.Assert(_exceptionContext == null);
_exceptionContext = new ExceptionContext(_actionContext, _filters);
_exceptionContext = new ExceptionContext(ActionContext, _filters);
try
{
@ -218,7 +176,7 @@ namespace Microsoft.AspNet.Mvc
{
_cursor.SetStage(FilterStage.AuthorizationFilters);
_authorizationContext = new AuthorizationContext(_actionContext, _filters);
_authorizationContext = new AuthorizationContext(ActionContext, _filters);
await InvokeAuthorizationFilter();
}
@ -260,16 +218,16 @@ namespace Microsoft.AspNet.Mvc
{
_cursor.SetStage(FilterStage.ActionFilters);
var arguments = await GetActionArguments(_actionContext.ModelState);
_actionExecutingContext = new ActionExecutingContext(_actionContext, _filters, arguments);
var arguments = await GetActionArguments(ActionContext.ModelState);
_actionExecutingContext = new ActionExecutingContext(ActionContext, _filters, arguments);
await InvokeActionMethodFilter();
}
internal async Task<IDictionary<string, object>> GetActionArguments(ModelStateDictionary modelState)
{
var actionBindingContext = await _bindingProvider.GetActionBindingContextAsync(_actionContext);
var parameters = _descriptor.Parameters;
var actionBindingContext = await _bindingProvider.GetActionBindingContextAsync(ActionContext);
var parameters = ActionContext.ActionDescriptor.Parameters;
var metadataProvider = actionBindingContext.MetadataProvider;
var parameterValues = new Dictionary<string, object>(parameters.Count, StringComparer.Ordinal);
@ -380,7 +338,7 @@ namespace Microsoft.AspNet.Mvc
// All action filters have run, execute the action method.
_actionExecutedContext = new ActionExecutedContext(_actionExecutingContext, _filters)
{
Result = await InvokeActionMethod()
Result = await InvokeActionAsync(_actionExecutingContext),
};
}
}
@ -395,27 +353,11 @@ namespace Microsoft.AspNet.Mvc
return _actionExecutedContext;
}
private async Task<IActionResult> InvokeActionMethod()
{
_cursor.SetStage(FilterStage.ActionMethod);
var actionMethodInfo = _descriptor.MethodInfo;
var actionReturnValue = await ReflectedActionExecutor.ExecuteAsync(
actionMethodInfo,
_actionContext.Controller,
_actionExecutingContext.ActionArguments);
var actionResult = CreateActionResult(
actionMethodInfo.ReturnType,
actionReturnValue);
return actionResult;
}
private async Task InvokeActionResultWithFilters(IActionResult result)
{
_cursor.SetStage(FilterStage.ResultFilters);
_resultExecutingContext = new ResultExecutingContext(_actionContext, _filters, result);
_resultExecutingContext = new ResultExecutingContext(ActionContext, _filters, result);
await InvokeActionResultFilter();
Contract.Assert(_resultExecutingContext != null);

View File

@ -7,6 +7,6 @@ namespace Microsoft.AspNet.Mvc
{
public interface IActionInvoker
{
Task InvokeActionAsync();
Task InvokeAsync();
}
}

View File

@ -47,6 +47,7 @@
<Compile Include="Formatters\JsonOutputFormatter.cs" />
<Compile Include="Formatters\MediaTypeWithQualityHeaderValueComparer.cs" />
<Compile Include="Formatters\OutputFormatter.cs" />
<Compile Include="FilterActionInvoker.cs" />
<Compile Include="OptionDescriptors\DefaultModelBinderProvider.cs" />
<Compile Include="OptionDescriptors\DefaultValueProviderFactoryProvider.cs" />
<Compile Include="OptionDescriptors\DefaultViewEngineProvider.cs" />
@ -286,4 +287,4 @@
<Compile Include="ViewDataDictionaryOfT.cs" />
</ItemGroup>
<Import Project="$(VSToolsPath)\AspNet\Microsoft.Web.AspNet.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>
</Project>

View File

@ -99,7 +99,7 @@ namespace Microsoft.AspNet.Mvc
throw ex;
}
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
context.IsHandled = true;
if (_logger.IsEnabled(TraceType.Information))

View File

@ -0,0 +1,84 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc.Core;
using Microsoft.Framework.DependencyInjection;
namespace Microsoft.AspNet.Mvc
{
public class ReflectedActionInvoker : FilterActionInvoker
{
private readonly ReflectedActionDescriptor _descriptor;
private readonly IControllerFactory _controllerFactory;
public ReflectedActionInvoker([NotNull] ActionContext actionContext,
[NotNull] IActionBindingContextProvider bindingContextProvider,
[NotNull] INestedProviderManager<FilterProviderContext> filterProvider,
[NotNull] IControllerFactory controllerFactory,
[NotNull] ReflectedActionDescriptor descriptor)
: base(actionContext, bindingContextProvider, filterProvider)
{
_descriptor = descriptor;
_controllerFactory = controllerFactory;
if (descriptor.MethodInfo == null)
{
throw new ArgumentException(
Resources.FormatPropertyOfTypeCannotBeNull("MethodInfo",
typeof(ReflectedActionDescriptor)),
"descriptor");
}
}
public override Task InvokeAsync()
{
ActionContext.Controller = _controllerFactory.CreateController(ActionContext);
return base.InvokeAsync();
}
protected override async Task<IActionResult> InvokeActionAsync(ActionExecutingContext actionExecutingContext)
{
var actionMethodInfo = _descriptor.MethodInfo;
var actionReturnValue = await ReflectedActionExecutor.ExecuteAsync(
actionMethodInfo,
ActionContext.Controller,
actionExecutingContext.ActionArguments);
var actionResult = CreateActionResult(
actionMethodInfo.ReturnType,
actionReturnValue);
return actionResult;
}
// Marking as internal for Unit Testing purposes.
internal static IActionResult CreateActionResult([NotNull] Type declaredReturnType, object actionReturnValue)
{
// optimize common path
var actionResult = actionReturnValue as IActionResult;
if (actionResult != null)
{
return actionResult;
}
if (declaredReturnType == typeof(void) ||
declaredReturnType == typeof(Task))
{
return new NoContentResult();
}
// Unwrap potential Task<T> types.
var actualReturnType = TypeHelper.GetTaskInnerTypeOrNull(declaredReturnType) ?? declaredReturnType;
if (actionReturnValue == null && typeof(IActionResult).IsAssignableFrom(actualReturnType))
{
throw new InvalidOperationException(
Resources.FormatActionResult_ActionReturnValueCannotBeNull(actualReturnType));
}
return new ObjectResult(actionReturnValue)
{
DeclaredType = actualReturnType
};
}
}
}

View File

@ -34,10 +34,10 @@ namespace Microsoft.AspNet.Mvc
{
context.Result = new ReflectedActionInvoker(
context.ActionContext,
actionDescriptor,
_controllerFactory,
_bindingProvider,
_filterProvider);
_filterProvider,
_controllerFactory,
actionDescriptor);
}
callNext();

View File

@ -107,7 +107,6 @@
<Compile Include="KnownRouteValueConstraintTests.cs" />
<Compile Include="RouteTemplateProviderAttributesTests.cs" />
<Compile Include="Routing\AttributeRoutePrecedenceTests.cs" />
<Compile Include="Routing\AttributeRouteTemplateTests.cs" />
<Compile Include="Routing\AttributeRouteTests.cs" />
<Compile Include="Routing\AttributeRoutingTest.cs" />
<Compile Include="StaticActionDiscoveryConventions.cs" />
@ -115,6 +114,7 @@
<Compile Include="TestController.cs" />
<Compile Include="TypeHelperTest.cs" />
<Compile Include="UrlHelperTest.cs" />
<Compile Include="ViewComponents\ViewViewComponentResultTest.cs" />
<Compile Include="ViewComponentTests.cs" />
<Compile Include="ViewResultTest.cs" />
</ItemGroup>

View File

@ -168,7 +168,7 @@ namespace Microsoft.AspNet.Mvc
if (invokerFactory == null)
{
var mockInvoker = new Mock<IActionInvoker>();
mockInvoker.Setup(i => i.InvokeActionAsync())
mockInvoker.Setup(i => i.InvokeAsync())
.Returns(Task.FromResult<object>(null));
var mockInvokerFactory = new Mock<IActionInvokerFactory>();

View File

@ -41,7 +41,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object, actionThrows: false);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(f => f.OnException(It.IsAny<ExceptionContext>()), Times.Never());
@ -60,7 +60,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object, actionThrows: false);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(
@ -91,7 +91,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object, actionThrows: true);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(f => f.OnException(It.IsAny<ExceptionContext>()), Times.Once());
@ -124,7 +124,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object, actionThrows: true);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(
@ -154,7 +154,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new[] { filter1.Object, filter2.Object }, actionThrows: true);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter2.Verify(
@ -182,7 +182,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { filter1.Object, filter2.Object }, actionThrows: true);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter2.Verify(
@ -202,7 +202,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object, actionThrows: true);
// Act
await Assert.ThrowsAsync(_actionException.GetType(), async () => await invoker.InvokeActionAsync());
await Assert.ThrowsAsync(_actionException.GetType(), async () => await invoker.InvokeAsync());
// Assert
filter.Verify(f => f.OnException(It.IsAny<ExceptionContext>()), Times.Once());
@ -229,7 +229,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { filter.Object, resultFilter.Object }, actionThrows: true);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(f => f.OnException(It.IsAny<ExceptionContext>()), Times.Once());
@ -246,7 +246,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(f => f.OnAuthorization(It.IsAny<AuthorizationContext>()), Times.Once());
@ -265,7 +265,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(
@ -290,7 +290,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new[] { filter1.Object, filter2.Object });
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter1.Verify(f => f.OnAuthorization(It.IsAny<AuthorizationContext>()), Times.Once());
@ -317,7 +317,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { filter1.Object, filter2.Object });
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter1.Verify(
@ -365,7 +365,7 @@ namespace Microsoft.AspNet.Mvc
});
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
exceptionFilter.Verify(f => f.OnException(It.IsAny<ExceptionContext>()), Times.Once());
@ -393,7 +393,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { authorizationFilter.Object, resultFilter.Object });
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
authorizationFilter.Verify(f => f.OnAuthorization(It.IsAny<AuthorizationContext>()), Times.Once());
@ -416,7 +416,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(f => f.OnActionExecuting(It.IsAny<ActionExecutingContext>()), Times.Once());
@ -444,7 +444,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(
@ -490,7 +490,7 @@ namespace Microsoft.AspNet.Mvc
});
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
actionFilter1.Verify(f => f.OnActionExecuting(It.IsAny<ActionExecutingContext>()), Times.Once());
@ -546,7 +546,7 @@ namespace Microsoft.AspNet.Mvc
});
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
actionFilter1.Verify(f => f.OnActionExecuting(It.IsAny<ActionExecutingContext>()), Times.Once());
@ -601,7 +601,7 @@ namespace Microsoft.AspNet.Mvc
});
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
actionFilter1.Verify(f => f.OnActionExecuting(It.IsAny<ActionExecutingContext>()), Times.Once());
@ -641,7 +641,7 @@ namespace Microsoft.AspNet.Mvc
// Act & Assert
await ExceptionAssert.ThrowsAsync<InvalidOperationException>(
async () => await invoker.InvokeActionAsync(),
async () => await invoker.InvokeAsync(),
message);
}
@ -668,7 +668,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object, actionThrows: true);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(f => f.OnActionExecuting(It.IsAny<ActionExecutingContext>()), Times.Once());
@ -709,7 +709,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new[] { filter1.Object, filter2.Object });
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter1.Verify(f => f.OnActionExecuting(It.IsAny<ActionExecutingContext>()), Times.Once());
@ -751,7 +751,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { filter1.Object, filter2.Object });
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter1.Verify(
@ -795,7 +795,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { actionFilter.Object, resultFilter.Object }, actionThrows: true);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
actionFilter.Verify(f => f.OnActionExecuting(It.IsAny<ActionExecutingContext>()), Times.Once());
@ -818,7 +818,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(f => f.OnResultExecuting(It.IsAny<ResultExecutingContext>()), Times.Once());
@ -838,7 +838,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter.Verify(
@ -874,7 +874,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { filter1.Object, filter2.Object, filter3.Object });
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter1.Verify(f => f.OnResultExecuting(It.IsAny<ResultExecutingContext>()), Times.Once());
@ -914,7 +914,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { filter1.Object, filter2.Object, filter3.Object });
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter1.Verify(f => f.OnResultExecuting(It.IsAny<ResultExecutingContext>()), Times.Once());
@ -956,7 +956,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { filter1.Object, filter2.Object, filter3.Object });
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
filter1.Verify(f => f.OnResultExecuting(It.IsAny<ResultExecutingContext>()), Times.Once());
@ -994,7 +994,7 @@ namespace Microsoft.AspNet.Mvc
// Act & Assert
await ExceptionAssert.ThrowsAsync<InvalidOperationException>(
async () => await invoker.InvokeActionAsync(),
async () => await invoker.InvokeAsync(),
message);
}
@ -1021,7 +1021,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object);
// Act
await Assert.ThrowsAsync(exception.GetType(), async () => await invoker.InvokeActionAsync());
await Assert.ThrowsAsync(exception.GetType(), async () => await invoker.InvokeAsync());
// Assert
result.Verify(r => r.ExecuteResultAsync(It.IsAny<ActionContext>()), Times.Once());
@ -1064,7 +1064,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
Assert.Equal(exception, context.Exception);
@ -1106,7 +1106,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(filter.Object);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
Assert.Equal(exception, context.Exception);
@ -1150,7 +1150,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { resultFilter1.Object, resultFilter2.Object, resultFilter3.Object });
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
Assert.Equal(exception, context.Exception);
@ -1192,7 +1192,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = CreateInvoker(new IFilter[] { resultFilter1.Object, resultFilter2.Object, resultFilter3.Object });
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
Assert.Equal(exception, context.Exception);
@ -1319,10 +1319,10 @@ namespace Microsoft.AspNet.Mvc
var invoker = new ReflectedActionInvoker(
actionContext,
actionDescriptor,
controllerFactory.Object,
actionBindingContextProvider.Object,
filterProvider.Object);
filterProvider.Object,
controllerFactory.Object,
actionDescriptor);
return invoker;
}
@ -1361,10 +1361,10 @@ namespace Microsoft.AspNet.Mvc
.Returns(Task.FromResult(bindingContext));
var invoker = new ReflectedActionInvoker(actionContext,
actionDescriptor,
Mock.Of<IControllerFactory>(),
actionBindingContextProvider.Object,
Mock.Of<INestedProviderManager<FilterProviderContext>>());
Mock.Of<INestedProviderManager<FilterProviderContext>>(),
Mock.Of<IControllerFactory>(),
actionDescriptor);
var modelStateDictionary = new ModelStateDictionary();
@ -1417,10 +1417,10 @@ namespace Microsoft.AspNet.Mvc
.Returns(Task.FromResult(bindingContext));
var invoker = new ReflectedActionInvoker(actionContext,
actionDescriptor,
Mock.Of<IControllerFactory>(),
actionBindingContextProvider.Object,
Mock.Of<INestedProviderManager<FilterProviderContext>>());
Mock.Of<INestedProviderManager<FilterProviderContext>>(),
Mock.Of<IControllerFactory>(),
actionDescriptor);
var modelStateDictionary = new ModelStateDictionary();
@ -1477,13 +1477,13 @@ namespace Microsoft.AspNet.Mvc
.Returns(new TestController());
var invoker = new ReflectedActionInvoker(actionContext,
actionDescriptor,
controllerFactory.Object,
actionBindingContextProvider.Object,
Mock.Of<INestedProviderManager<FilterProviderContext>>());
Mock.Of<INestedProviderManager<FilterProviderContext>>(),
controllerFactory.Object,
actionDescriptor);
// Act
await invoker.InvokeActionAsync();
await invoker.InvokeAsync();
// Assert
Assert.Equal(5, context.Object.Items["Result"]);