Refactor invoker tests for reuse

This commit is contained in:
Ryan Nowak 2017-05-24 13:56:16 -07:00
parent b7db6dbc8e
commit e7bd6cfc06
4 changed files with 2487 additions and 2581 deletions

View File

@ -47,6 +47,9 @@ namespace Microsoft.AspNetCore.Mvc.Internal
_controllerContext = controllerContext; _controllerContext = controllerContext;
} }
// Internal for testing
internal ControllerContext ControllerContext => _controllerContext;
protected override void ReleaseResources() protected override void ReleaseResources()
{ {
if (_controller != null && _cacheEntry.ControllerReleaser != null) if (_controller != null && _cacheEntry.ControllerReleaser != null)

View File

@ -248,15 +248,15 @@ namespace Microsoft.AspNetCore.Mvc.Internal
if (actionThrows) if (actionThrows)
{ {
actionDescriptor.MethodInfo = typeof(ControllerActionInvokerTest).GetMethod( actionDescriptor.MethodInfo = typeof(ControllerActionInvokerTest.TestController).GetMethod(
nameof(ControllerActionInvokerTest.ThrowingActionMethod)); nameof(ControllerActionInvokerTest.TestController.ThrowingActionMethod));
} }
else else
{ {
actionDescriptor.MethodInfo = typeof(ControllerActionInvokerTest).GetMethod( actionDescriptor.MethodInfo = typeof(ControllerActionInvokerTest.TestController).GetMethod(
nameof(ControllerActionInvokerTest.ActionMethod)); nameof(ControllerActionInvokerTest.TestController.ActionMethod));
} }
actionDescriptor.ControllerTypeInfo = typeof(ControllerActionInvokerTest).GetTypeInfo(); actionDescriptor.ControllerTypeInfo = typeof(ControllerActionInvokerTest.TestController).GetTypeInfo();
return CreateInvoker(filters, actionDescriptor, _controller); return CreateInvoker(filters, actionDescriptor, _controller);
} }

File diff suppressed because it is too large Load Diff