@@ -1272,12 +1272,12 @@ public void CreateActionResult_ReturnsObjectContentResult(Type type, object inpu
1272
1272
Assert . Same ( input , contentResult . Value ) ;
1273
1273
}
1274
1274
1275
- private ReflectedActionInvoker CreateInvoker ( IFilter filter , bool actionThrows = false )
1275
+ private TestReflectedActionInvoker CreateInvoker ( IFilter filter , bool actionThrows = false )
1276
1276
{
1277
1277
return CreateInvoker ( new [ ] { filter } , actionThrows ) ;
1278
1278
}
1279
1279
1280
- private ReflectedActionInvoker CreateInvoker ( IFilter [ ] filters , bool actionThrows = false )
1280
+ private TestReflectedActionInvoker CreateInvoker ( IFilter [ ] filters , bool actionThrows = false )
1281
1281
{
1282
1282
var actionDescriptor = new ReflectedActionDescriptor ( )
1283
1283
{
@@ -1319,6 +1319,7 @@ private ReflectedActionInvoker CreateInvoker(IFilter[] filters, bool actionThrow
1319
1319
1320
1320
var controllerFactory = new Mock < IControllerFactory > ( ) ;
1321
1321
controllerFactory . Setup ( c => c . CreateController ( It . IsAny < ActionContext > ( ) ) ) . Returns ( this ) ;
1322
+ controllerFactory . Setup ( m => m . ReleaseController ( this ) ) . Verifiable ( ) ;
1322
1323
1323
1324
var actionBindingContextProvider = new Mock < IActionBindingContextProvider > ( MockBehavior . Strict ) ;
1324
1325
actionBindingContextProvider
@@ -1333,11 +1334,12 @@ private ReflectedActionInvoker CreateInvoker(IFilter[] filters, bool actionThrow
1333
1334
var inputFormattersProvider = new Mock < IInputFormattersProvider > ( ) ;
1334
1335
inputFormattersProvider . SetupGet ( o => o . InputFormatters )
1335
1336
. Returns ( new List < IInputFormatter > ( ) ) ;
1336
- var invoker = new ReflectedActionInvoker (
1337
+
1338
+ var invoker = new TestReflectedActionInvoker (
1337
1339
actionContext ,
1338
1340
actionBindingContextProvider . Object ,
1339
1341
filterProvider . Object ,
1340
- controllerFactory . Object ,
1342
+ controllerFactory ,
1341
1343
actionDescriptor ,
1342
1344
inputFormattersProvider . Object ) ;
1343
1345
@@ -1613,5 +1615,34 @@ public Task ExecuteResultAsync(ActionContext context)
1613
1615
return Task . FromResult ( 0 ) ;
1614
1616
}
1615
1617
}
1618
+
1619
+ public class TestReflectedActionInvoker : ReflectedActionInvoker
1620
+ {
1621
+ private Mock < IControllerFactory > _factoryMock ;
1622
+
1623
+ public TestReflectedActionInvoker (
1624
+ ActionContext actionContext ,
1625
+ IActionBindingContextProvider bindingContextProvider ,
1626
+ INestedProviderManager < FilterProviderContext > filterProvider ,
1627
+ Mock < IControllerFactory > controllerFactoryMock ,
1628
+ ReflectedActionDescriptor descriptor ,
1629
+ IInputFormattersProvider inputFormattersProvider ) :
1630
+ base ( actionContext ,
1631
+ bindingContextProvider ,
1632
+ filterProvider ,
1633
+ controllerFactoryMock . Object ,
1634
+ descriptor ,
1635
+ inputFormattersProvider )
1636
+ {
1637
+ _factoryMock = controllerFactoryMock ;
1638
+ }
1639
+
1640
+ public async override Task InvokeAsync ( )
1641
+ {
1642
+ await base . InvokeAsync ( ) ;
1643
+
1644
+ _factoryMock . Verify ( ) ;
1645
+ }
1646
+ }
1616
1647
}
1617
1648
}
0 commit comments