diff --git a/src/Microsoft.AspNet.Mvc.Core/ActionContext.cs b/src/Microsoft.AspNet.Mvc.Core/ActionContext.cs
index ff754b235c..1cd298c758 100644
--- a/src/Microsoft.AspNet.Mvc.Core/ActionContext.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/ActionContext.cs
@@ -14,7 +14,6 @@ namespace Microsoft.AspNet.Mvc
: this(actionContext.HttpContext, actionContext.RouteData, actionContext.ActionDescriptor)
{
ModelState = actionContext.ModelState;
- Controller = actionContext.Controller;
}
public ActionContext([NotNull] RouteContext routeContext, [NotNull] ActionDescriptor actionDescriptor)
@@ -39,10 +38,5 @@ namespace Microsoft.AspNet.Mvc
public ModelStateDictionary ModelState { get; private set; }
public ActionDescriptor ActionDescriptor { get; private set; }
-
- ///
- /// The controller is available only after the controller factory runs.
- ///
- public object Controller { get; set; }
}
}
diff --git a/src/Microsoft.AspNet.Mvc.Core/ControllerActionInvoker.cs b/src/Microsoft.AspNet.Mvc.Core/ControllerActionInvoker.cs
index c55ad38441..9c4bdcf9a3 100644
--- a/src/Microsoft.AspNet.Mvc.Core/ControllerActionInvoker.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/ControllerActionInvoker.cs
@@ -50,21 +50,16 @@ namespace Microsoft.AspNet.Mvc
}
}
- public async override Task InvokeAsync()
+ protected override object CreateInstance()
{
// The binding context is used in activation
Debug.Assert(ActionBindingContext != null);
- var controller = _controllerFactory.CreateController(ActionContext);
+ return _controllerFactory.CreateController(ActionContext);
+ }
- try
- {
- ActionContext.Controller = controller;
- await base.InvokeAsync();
- }
- finally
- {
- _controllerFactory.ReleaseController(ActionContext.Controller);
- }
+ protected override void ReleaseInstance(object instance)
+ {
+ _controllerFactory.ReleaseController(instance);
}
protected override async Task InvokeActionAsync(ActionExecutingContext actionExecutingContext)
@@ -72,7 +67,7 @@ namespace Microsoft.AspNet.Mvc
var actionMethodInfo = _descriptor.MethodInfo;
var actionReturnValue = await ControllerActionExecutor.ExecuteAsync(
actionMethodInfo,
- ActionContext.Controller,
+ actionExecutingContext.Controller,
actionExecutingContext.ActionArguments);
var actionResult = CreateActionResult(
diff --git a/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs b/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs
index e634dcbfe6..8f88a1594e 100644
--- a/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/DefaultControllerFactory.cs
@@ -37,7 +37,6 @@ namespace Microsoft.AspNet.Mvc
_serviceProvider,
actionDescriptor.ControllerTypeInfo.AsType());
- actionContext.Controller = controller;
_controllerActivator.Activate(controller, actionContext);
return controller;
diff --git a/src/Microsoft.AspNet.Mvc.Core/FilterActionInvoker.cs b/src/Microsoft.AspNet.Mvc.Core/FilterActionInvoker.cs
index 5f433107cf..d077bcb4e4 100644
--- a/src/Microsoft.AspNet.Mvc.Core/FilterActionInvoker.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/FilterActionInvoker.cs
@@ -55,8 +55,6 @@ namespace Microsoft.AspNet.Mvc
_modelValidatorProviderProvider = modelValidatorProviderProvider;
_valueProviderFactoryProvider = valueProviderFactoryProvider;
_actionBindingContextAccessor = actionBindingContextAccessor;
-
- ActionBindingContext = new ActionBindingContext();
}
protected ActionContext ActionContext { get; private set; }
@@ -73,6 +71,21 @@ namespace Microsoft.AspNet.Mvc
}
}
+ protected object Instance { get; private set; }
+
+ ///
+ /// Called to create an instance of an object which will act as the reciever of the action invocation.
+ ///
+ /// The constructed instance or null.
+ protected abstract object CreateInstance();
+
+ ///
+ /// Called to create an instance of an object which will act as the reciever of the action invocation.
+ ///
+ /// The instance to release.
+ /// This method will not be called if returns null.
+ protected abstract void ReleaseInstance(object instance);
+
protected abstract Task InvokeActionAsync(ActionExecutingContext actionExecutingContext);
protected abstract Task> GetActionArgumentsAsync(
@@ -95,7 +108,20 @@ namespace Microsoft.AspNet.Mvc
return;
}
- await InvokeAllResourceFiltersAsync();
+ try
+ {
+ await InvokeAllResourceFiltersAsync();
+ }
+ finally
+ {
+ // Release the instance after all filters have run. We don't need to surround
+ // Authorizations filters because the instance will be created much later than
+ // that.
+ if (Instance != null)
+ {
+ ReleaseInstance(Instance);
+ }
+ }
// We've reached the end of resource filters. If there's an unhandled exception on the context then
// it should be thrown and middleware has a chance to handle it.
@@ -207,7 +233,7 @@ namespace Microsoft.AspNet.Mvc
if (item.FilterAsync != null)
{
await item.FilterAsync.OnResourceExecutionAsync(
- _resourceExecutingContext,
+ _resourceExecutingContext,
InvokeResourceFilterAsync);
if (_resourceExecutedContext == null)
@@ -384,23 +410,30 @@ namespace Microsoft.AspNet.Mvc
Debug.Assert(_resourceExecutingContext != null);
- Debug.Assert(ActionBindingContext != null);
+ ActionBindingContext = new ActionBindingContext();
ActionBindingContext.InputFormatters = _resourceExecutingContext.InputFormatters;
ActionBindingContext.ModelBinder = new CompositeModelBinder(_resourceExecutingContext.ModelBinders);
ActionBindingContext.ValidatorProvider = new CompositeModelValidatorProvider(
_resourceExecutingContext.ValidatorProviders);
var valueProviderFactoryContext = new ValueProviderFactoryContext(
- ActionContext.HttpContext,
+ ActionContext.HttpContext,
ActionContext.RouteData.Values);
ActionBindingContext.ValueProvider = CompositeValueProvider.Create(
_resourceExecutingContext.ValueProviderFactories,
valueProviderFactoryContext);
+ Instance = CreateInstance();
+
var arguments = await GetActionArgumentsAsync(ActionContext, ActionBindingContext);
- _actionExecutingContext = new ActionExecutingContext(ActionContext, _filters, arguments);
+ _actionExecutingContext = new ActionExecutingContext(
+ ActionContext,
+ _filters,
+ arguments,
+ Instance);
+
await InvokeActionFilterAsync();
}
@@ -429,7 +462,10 @@ namespace Microsoft.AspNet.Mvc
if (_actionExecutedContext == null)
{
// If we get here then the filter didn't call 'next' indicating a short circuit
- _actionExecutedContext = new ActionExecutedContext(_actionExecutingContext, _filters)
+ _actionExecutedContext = new ActionExecutedContext(
+ _actionExecutingContext,
+ _filters,
+ Instance)
{
Canceled = true,
Result = _actionExecutingContext.Result,
@@ -443,7 +479,10 @@ namespace Microsoft.AspNet.Mvc
if (_actionExecutingContext.Result != null)
{
// Short-circuited by setting a result.
- _actionExecutedContext = new ActionExecutedContext(_actionExecutingContext, _filters)
+ _actionExecutedContext = new ActionExecutedContext(
+ _actionExecutingContext,
+ _filters,
+ Instance)
{
Canceled = true,
Result = _actionExecutingContext.Result,
@@ -457,7 +496,10 @@ namespace Microsoft.AspNet.Mvc
else
{
// All action filters have run, execute the action method.
- _actionExecutedContext = new ActionExecutedContext(_actionExecutingContext, _filters)
+ _actionExecutedContext = new ActionExecutedContext(
+ _actionExecutingContext,
+ _filters,
+ Instance)
{
Result = await InvokeActionAsync(_actionExecutingContext),
};
@@ -466,7 +508,10 @@ namespace Microsoft.AspNet.Mvc
catch (Exception exception)
{
// Exceptions thrown by the action method OR filters bubble back up through ActionExcecutedContext.
- _actionExecutedContext = new ActionExecutedContext(_actionExecutingContext, _filters)
+ _actionExecutedContext = new ActionExecutedContext(
+ _actionExecutingContext,
+ _filters,
+ Instance)
{
ExceptionDispatchInfo = ExceptionDispatchInfo.Capture(exception)
};
@@ -478,7 +523,7 @@ namespace Microsoft.AspNet.Mvc
{
_cursor.SetStage(FilterStage.ResultFilters);
- _resultExecutingContext = new ResultExecutingContext(ActionContext, _filters, result);
+ _resultExecutingContext = new ResultExecutingContext(ActionContext, _filters, result, Instance);
await InvokeResultFilterAsync();
Debug.Assert(_resultExecutingContext != null);
@@ -525,7 +570,8 @@ namespace Microsoft.AspNet.Mvc
_resultExecutedContext = new ResultExecutedContext(
_resultExecutingContext,
_filters,
- _resultExecutingContext.Result)
+ _resultExecutingContext.Result,
+ Instance)
{
Canceled = true,
};
@@ -536,7 +582,8 @@ namespace Microsoft.AspNet.Mvc
_resultExecutedContext = new ResultExecutedContext(
_resultExecutingContext,
_filters,
- _resultExecutingContext.Result)
+ _resultExecutingContext.Result,
+ Instance)
{
Canceled = true,
};
@@ -552,7 +599,8 @@ namespace Microsoft.AspNet.Mvc
_resultExecutedContext = new ResultExecutedContext(
_resultExecutingContext,
_filters,
- _resultExecutingContext.Result)
+ _resultExecutingContext.Result,
+ Instance)
{
Canceled = true,
};
@@ -570,7 +618,8 @@ namespace Microsoft.AspNet.Mvc
_resultExecutedContext = new ResultExecutedContext(
_resultExecutingContext,
_filters,
- _resultExecutingContext.Result);
+ _resultExecutingContext.Result,
+ Instance);
}
}
catch (Exception exception)
@@ -578,7 +627,8 @@ namespace Microsoft.AspNet.Mvc
_resultExecutedContext = new ResultExecutedContext(
_resultExecutingContext,
_filters,
- _resultExecutingContext.Result)
+ _resultExecutingContext.Result,
+ Instance)
{
ExceptionDispatchInfo = ExceptionDispatchInfo.Capture(exception)
};
diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ActionExecutedContext.cs b/src/Microsoft.AspNet.Mvc.Core/Filters/ActionExecutedContext.cs
index 1c6d6bb817..984c21ebd8 100644
--- a/src/Microsoft.AspNet.Mvc.Core/Filters/ActionExecutedContext.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/Filters/ActionExecutedContext.cs
@@ -14,13 +14,17 @@ namespace Microsoft.AspNet.Mvc
public ActionExecutedContext(
[NotNull] ActionContext actionContext,
- [NotNull] IList filters)
+ [NotNull] IList filters,
+ object controller)
: base(actionContext, filters)
{
+ Controller = controller;
}
public virtual bool Canceled { get; set; }
+ public virtual object Controller { get; }
+
public virtual Exception Exception
{
get
diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ActionExecutingContext.cs b/src/Microsoft.AspNet.Mvc.Core/Filters/ActionExecutingContext.cs
index 85756a35c9..80bc25ee9e 100644
--- a/src/Microsoft.AspNet.Mvc.Core/Filters/ActionExecutingContext.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/Filters/ActionExecutingContext.cs
@@ -10,14 +10,18 @@ namespace Microsoft.AspNet.Mvc
public ActionExecutingContext(
[NotNull] ActionContext actionContext,
[NotNull] IList filters,
- [NotNull] IDictionary actionArguments)
+ [NotNull] IDictionary actionArguments,
+ object controller)
: base(actionContext, filters)
{
ActionArguments = actionArguments;
+ Controller = controller;
}
public virtual IActionResult Result { get; set; }
- public virtual IDictionary ActionArguments { get; private set; }
+ public virtual IDictionary ActionArguments { get; }
+
+ public virtual object Controller { get; }
}
}
diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ResultExecutedContext.cs b/src/Microsoft.AspNet.Mvc.Core/Filters/ResultExecutedContext.cs
index 08e454ebfb..594b61f2e4 100644
--- a/src/Microsoft.AspNet.Mvc.Core/Filters/ResultExecutedContext.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/Filters/ResultExecutedContext.cs
@@ -15,14 +15,18 @@ namespace Microsoft.AspNet.Mvc
public ResultExecutedContext(
[NotNull] ActionContext actionContext,
[NotNull] IList filters,
- [NotNull] IActionResult result)
+ [NotNull] IActionResult result,
+ object controller)
: base(actionContext, filters)
{
Result = result;
+ Controller = controller;
}
public virtual bool Canceled { get; set; }
+ public virtual object Controller { get; }
+
public virtual Exception Exception
{
get
diff --git a/src/Microsoft.AspNet.Mvc.Core/Filters/ResultExecutingContext.cs b/src/Microsoft.AspNet.Mvc.Core/Filters/ResultExecutingContext.cs
index 26d7c7c7ed..3a89d3638f 100644
--- a/src/Microsoft.AspNet.Mvc.Core/Filters/ResultExecutingContext.cs
+++ b/src/Microsoft.AspNet.Mvc.Core/Filters/ResultExecutingContext.cs
@@ -10,12 +10,16 @@ namespace Microsoft.AspNet.Mvc
public ResultExecutingContext(
[NotNull] ActionContext actionContext,
[NotNull] IList filters,
- [NotNull] IActionResult result)
+ [NotNull] IActionResult result,
+ object controller)
: base(actionContext, filters)
{
Result = result;
+ Controller = controller;
}
+ public virtual object Controller { get; }
+
public virtual IActionResult Result { get; set; }
public virtual bool Cancel { get; set; }
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs
index 3277056e17..c10fb36c67 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ControllerActionInvokerTest.cs
@@ -296,6 +296,7 @@ namespace Microsoft.AspNet.Mvc
// Assert
filter1.Verify(f => f.OnAuthorization(It.IsAny()), Times.Once());
+ Assert.False(invoker.ControllerFactory.CreateCalled);
}
[Fact]
@@ -325,6 +326,8 @@ namespace Microsoft.AspNet.Mvc
filter1.Verify(
f => f.OnAuthorizationAsync(It.IsAny()),
Times.Once());
+
+ Assert.False(invoker.ControllerFactory.CreateCalled);
}
[Fact]
@@ -1735,6 +1738,7 @@ namespace Microsoft.AspNet.Mvc
// Assert
Assert.Same(expected.Object, context.Result);
Assert.True(context.Canceled);
+ Assert.False(invoker.ControllerFactory.CreateCalled);
}
[Fact]
@@ -1786,6 +1790,7 @@ namespace Microsoft.AspNet.Mvc
// Assert
Assert.Same(expected.Object, context.Result);
Assert.True(context.Canceled);
+ Assert.False(invoker.ControllerFactory.CreateCalled);
}
[Fact]
@@ -1847,6 +1852,8 @@ namespace Microsoft.AspNet.Mvc
resourceFilter.Verify(
f => f.OnResourceExecutionAsync(It.IsAny(), It.IsAny()),
Times.Never());
+
+ Assert.False(invoker.ControllerFactory.CreateCalled);
}
[Fact]
@@ -1969,10 +1976,6 @@ namespace Microsoft.AspNet.Mvc
routeData: new RouteData(),
actionDescriptor: actionDescriptor);
- var controllerFactory = new Mock();
- controllerFactory.Setup(c => c.CreateController(It.IsAny())).Returns(this);
- controllerFactory.Setup(m => m.ReleaseController(this)).Verifiable();
-
var filterProvider = new Mock>(MockBehavior.Strict);
filterProvider
.Setup(fp => fp.Invoke(It.IsAny()))
@@ -1985,7 +1988,7 @@ namespace Microsoft.AspNet.Mvc
var invoker = new TestControllerActionInvoker(
actionContext,
filterProvider.Object,
- controllerFactory,
+ new MockControllerFactory(this),
actionDescriptor,
inputFormattersProvider.Object,
Mock.Of(),
@@ -1997,8 +2000,6 @@ namespace Microsoft.AspNet.Mvc
return invoker;
}
-
-
[Fact]
public async Task Invoke_UsesDefaultValuesIfNotBound()
{
@@ -2097,14 +2098,47 @@ namespace Microsoft.AspNet.Mvc
}
}
- public class TestControllerActionInvoker : ControllerActionInvoker
+ private class MockControllerFactory : IControllerFactory
{
- private Mock _factoryMock;
+ private object _controller;
+ public MockControllerFactory(object controller)
+ {
+ _controller = controller;
+ }
+
+ public bool CreateCalled { get; private set; }
+
+ public bool ReleaseCalled { get; private set; }
+
+ public object CreateController(ActionContext actionContext)
+ {
+ CreateCalled = true;
+ return _controller;
+ }
+
+ public void ReleaseController(object controller)
+ {
+ Assert.NotNull(controller);
+ Assert.Same(_controller, controller);
+ ReleaseCalled = true;
+ }
+
+ public void Verify()
+ {
+ if (CreateCalled && !ReleaseCalled)
+ {
+ Assert.False(true, "ReleaseController should have been called.");
+ }
+ }
+ }
+
+ private class TestControllerActionInvoker : ControllerActionInvoker
+ {
public TestControllerActionInvoker(
ActionContext actionContext,
INestedProviderManager filterProvider,
- Mock controllerFactoryMock,
+ MockControllerFactory controllerFactory,
ControllerActionDescriptor descriptor,
IInputFormattersProvider inputFormattersProvider,
IControllerActionArgumentBinder controllerActionArgumentBinder,
@@ -2115,7 +2149,7 @@ namespace Microsoft.AspNet.Mvc
: base(
actionContext,
filterProvider,
- controllerFactoryMock.Object,
+ controllerFactory,
descriptor,
inputFormattersProvider,
controllerActionArgumentBinder,
@@ -2124,14 +2158,17 @@ namespace Microsoft.AspNet.Mvc
valueProviderFactoryProvider,
actionBindingContext)
{
- _factoryMock = controllerFactoryMock;
+ ControllerFactory = controllerFactory;
}
+ public MockControllerFactory ControllerFactory { get; }
+
public async override Task InvokeAsync()
{
await base.InvokeAsync();
- _factoryMock.Verify();
+ // Make sure that the controller was disposed in every test that creates ones.
+ ControllerFactory.Verify();
}
}
}
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerActivatorTest.cs b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerActivatorTest.cs
index d19d772270..094194172e 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerActivatorTest.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/DefaultControllerActivatorTest.cs
@@ -29,10 +29,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test
.Returns(services);
var routeContext = new RouteContext(httpContext.Object);
var controller = new TestController();
- var context = new ActionContext(routeContext, new ActionDescriptor())
- {
- Controller = controller
- };
+ var context = new ActionContext(routeContext, new ActionDescriptor());
var activator = new DefaultControllerActivator();
// Act
@@ -55,10 +52,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test
.Returns(services);
var routeContext = new RouteContext(httpContext.Object);
var controller = new TestController();
- var context = new ActionContext(routeContext, new ActionDescriptor())
- {
- Controller = controller
- };
+ var context = new ActionContext(routeContext, new ActionDescriptor());
var activator = new DefaultControllerActivator();
// Act
@@ -83,10 +77,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test
var routeContext = new RouteContext(httpContext.Object);
var controller = new TestController();
- var context = new ActionContext(routeContext, new ActionDescriptor())
- {
- Controller = controller
- };
+ var context = new ActionContext(routeContext, new ActionDescriptor());
var activator = new DefaultControllerActivator();
@@ -109,10 +100,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test
.Returns(services);
var routeContext = new RouteContext(httpContext.Object);
var controller = new TestController();
- var context = new ActionContext(routeContext, new ActionDescriptor())
- {
- Controller = controller
- };
+ var context = new ActionContext(routeContext, new ActionDescriptor());
var activator = new DefaultControllerActivator();
// Act
@@ -135,10 +123,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test
.Returns(services);
var routeContext = new RouteContext(httpContext.Object);
var controller = new TestController();
- var context = new ActionContext(routeContext, new ActionDescriptor())
- {
- Controller = controller
- };
+ var context = new ActionContext(routeContext, new ActionDescriptor());
var activator = new DefaultControllerActivator();
// Act
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ActionFilterAttributeTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ActionFilterAttributeTests.cs
index 1bcf9095c0..b450b7d8b4 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ActionFilterAttributeTests.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ActionFilterAttributeTests.cs
@@ -227,12 +227,13 @@ namespace Microsoft.AspNet.Mvc.Test
return new ActionExecutingContext(
CreateActionContext(),
new IFilter[] { filter, },
- new Dictionary());
+ new Dictionary(),
+ controller: new object());
}
private static ActionExecutedContext CreateActionExecutedContext(ActionExecutingContext context)
{
- return new ActionExecutedContext(context, context.Filters)
+ return new ActionExecutedContext(context, context.Filters, context.Controller)
{
Result = context.Result,
};
@@ -243,12 +244,13 @@ namespace Microsoft.AspNet.Mvc.Test
return new ResultExecutingContext(
CreateActionContext(),
new IFilter[] { filter, },
- new NoOpResult());
+ new NoOpResult(),
+ controller: new object());
}
private static ResultExecutedContext CreateResultExecutedContext(ResultExecutingContext context)
{
- return new ResultExecutedContext(context, context.Filters, context.Result);
+ return new ResultExecutedContext(context, context.Filters, context.Result, context.Controller);
}
private static ActionContext CreateActionContext()
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ProducesAttributeTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ProducesAttributeTests.cs
index a939a94e48..3e723bb0d8 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ProducesAttributeTests.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/Filters/ProducesAttributeTests.cs
@@ -62,7 +62,7 @@ namespace Microsoft.AspNet.Mvc.Test
private static ResultExecutedContext CreateResultExecutedContext(ResultExecutingContext context)
{
- return new ResultExecutedContext(context, context.Filters, context.Result);
+ return new ResultExecutedContext(context, context.Filters, context.Result, context.Controller);
}
private static ResultExecutingContext CreateResultExecutingContext(IFilter filter)
@@ -70,7 +70,8 @@ namespace Microsoft.AspNet.Mvc.Test
return new ResultExecutingContext(
CreateActionContext(),
new IFilter[] { filter, },
- new ObjectResult("Some Value"));
+ new ObjectResult("Some Value"),
+ controller: new object());
}
private static ActionContext CreateActionContext()
diff --git a/test/Microsoft.AspNet.Mvc.Core.Test/ParameterBinding/ControllerActionArgumentBinderTests.cs b/test/Microsoft.AspNet.Mvc.Core.Test/ParameterBinding/ControllerActionArgumentBinderTests.cs
index 7116349977..739913a204 100644
--- a/test/Microsoft.AspNet.Mvc.Core.Test/ParameterBinding/ControllerActionArgumentBinderTests.cs
+++ b/test/Microsoft.AspNet.Mvc.Core.Test/ParameterBinding/ControllerActionArgumentBinderTests.cs
@@ -190,12 +190,7 @@ namespace Microsoft.AspNet.Mvc.Core.Test
})
.Returns(Task.FromResult(result: false));
- var actionContext = new ActionContext(
- new RouteContext(Mock.Of()),
- actionDescriptor)
- {
- Controller = Mock.Of