66 using FluentAssertions ;
77 using Http ;
88 using Moq ;
9+ using System . Collections . Generic ;
910 using System . Linq ;
1011 using Versioning ;
1112 using Xunit ;
1213
1314 public class ReportApiVersionsAttributeTest
1415 {
15- static ActionExecutedContext CreateContext ( ApiVersionModel model )
16+ static ActionExecutingContext CreateContext ( ApiVersionModel model )
1617 {
1718 var headers = new HeaderDictionary ( ) ;
1819 var response = new Mock < HttpResponse > ( ) ;
1920 var httpContext = new Mock < HttpContext > ( ) ;
2021 var action = new ActionDescriptor ( ) ;
2122 var actionContext = new ActionContext ( httpContext . Object , new RouteData ( ) , action ) ;
23+ var filters = new IFilterMetadata [ 0 ] ;
24+ var actionArguments = new Dictionary < string , object > ( ) ;
25+ var controller = default ( object ) ;
2226
2327 response . SetupGet ( r => r . Headers ) . Returns ( headers ) ;
2428 httpContext . SetupGet ( c => c . Response ) . Returns ( response . Object ) ;
2529 action . SetProperty ( model ) ;
2630
27- return new ActionExecutedContext ( actionContext , new IFilterMetadata [ 0 ] , null ) ;
31+ return new ActionExecutingContext ( actionContext , filters , actionArguments , controller ) ;
2832 }
2933
3034 [ Fact ]
31- public void on_action_executed_should_add_version_headers ( )
35+ public void on_action_executing_should_add_version_headers ( )
3236 {
3337 // arrange
3438 var supported = new [ ] { new ApiVersion ( 1 , 0 ) , new ApiVersion ( 2 , 0 ) } ;
@@ -38,7 +42,7 @@ public void on_action_executed_should_add_version_headers()
3842 var attribute = new ReportApiVersionsAttribute ( ) ;
3943
4044 // act
41- attribute . OnActionExecuted ( context ) ;
45+ attribute . OnActionExecuting ( context ) ;
4246
4347 // assert
4448 context . HttpContext . Response . Headers [ "api-supported-versions" ] . Single ( ) . Should ( ) . Be ( "1.0, 2.0" ) ;
@@ -53,7 +57,7 @@ public void on_action_executing_should_not_add_headers_for_versionX2Dneutral_con
5357 var attribute = new ReportApiVersionsAttribute ( ) ;
5458
5559 // act
56- attribute . OnActionExecuted ( context ) ;
60+ attribute . OnActionExecuting ( context ) ;
5761
5862
5963 // assert
0 commit comments