@@ -86,7 +86,7 @@ public async Task RequestDelegateInvokesAction(Delegate @delegate)
8686 {
8787 var httpContext = new DefaultHttpContext ( ) ;
8888
89- var requestDelegate = RequestDelegateFactory . Build ( @delegate ) ;
89+ var requestDelegate = RequestDelegateFactory . Create ( @delegate ) ;
9090
9191 await requestDelegate ( httpContext ) ;
9292
@@ -106,7 +106,7 @@ public async Task StaticMethodInfoOverloadWorksWithBasicReflection()
106106 BindingFlags . NonPublic | BindingFlags . Static ,
107107 new [ ] { typeof ( HttpContext ) } ) ;
108108
109- var requestDelegate = RequestDelegateFactory . Build ( methodInfo ! ) ;
109+ var requestDelegate = RequestDelegateFactory . Create ( methodInfo ! ) ;
110110
111111 var httpContext = new DefaultHttpContext ( ) ;
112112
@@ -151,7 +151,7 @@ object GetTarget()
151151 return new TestNonStaticActionClass ( 2 ) ;
152152 }
153153
154- var requestDelegate = RequestDelegateFactory . Build ( methodInfo ! , _ => GetTarget ( ) ) ;
154+ var requestDelegate = RequestDelegateFactory . Create ( methodInfo ! , _ => GetTarget ( ) ) ;
155155
156156 var httpContext = new DefaultHttpContext ( ) ;
157157
@@ -174,10 +174,10 @@ public void BuildRequestDelegateThrowsArgumentNullExceptions()
174174 BindingFlags . NonPublic | BindingFlags . Static ,
175175 new [ ] { typeof ( HttpContext ) } ) ;
176176
177- var exNullAction = Assert . Throws < ArgumentNullException > ( ( ) => RequestDelegateFactory . Build ( action : null ! ) ) ;
178- var exNullMethodInfo1 = Assert . Throws < ArgumentNullException > ( ( ) => RequestDelegateFactory . Build ( methodInfo : null ! ) ) ;
179- var exNullMethodInfo2 = Assert . Throws < ArgumentNullException > ( ( ) => RequestDelegateFactory . Build ( methodInfo : null ! , _ => 0 ) ) ;
180- var exNullTargetFactory = Assert . Throws < ArgumentNullException > ( ( ) => RequestDelegateFactory . Build ( methodInfo ! , targetFactory : null ! ) ) ;
177+ var exNullAction = Assert . Throws < ArgumentNullException > ( ( ) => RequestDelegateFactory . Create ( action : null ! ) ) ;
178+ var exNullMethodInfo1 = Assert . Throws < ArgumentNullException > ( ( ) => RequestDelegateFactory . Create ( methodInfo : null ! ) ) ;
179+ var exNullMethodInfo2 = Assert . Throws < ArgumentNullException > ( ( ) => RequestDelegateFactory . Create ( methodInfo : null ! , _ => 0 ) ) ;
180+ var exNullTargetFactory = Assert . Throws < ArgumentNullException > ( ( ) => RequestDelegateFactory . Create ( methodInfo ! , targetFactory : null ! ) ) ;
181181
182182 Assert . Equal ( "action" , exNullAction . ParamName ) ;
183183 Assert . Equal ( "methodInfo" , exNullMethodInfo1 . ParamName ) ;
@@ -229,7 +229,7 @@ public async Task RequestDelegatePopulatesFromRouteParameterBasedOnParameterName
229229 var httpContext = new DefaultHttpContext ( ) ;
230230 httpContext . Request . RouteValues [ paramName ] = originalRouteParam . ToString ( NumberFormatInfo . InvariantInfo ) ;
231231
232- var requestDelegate = RequestDelegateFactory . Build ( @delegate ) ;
232+ var requestDelegate = RequestDelegateFactory . Create ( @delegate ) ;
233233
234234 await requestDelegate ( httpContext ) ;
235235
@@ -272,7 +272,7 @@ public async Task RequestDelegatePopulatesFromRouteOptionalParameter(Delegate @d
272272 {
273273 var httpContext = new DefaultHttpContext ( ) ;
274274
275- var requestDelegate = RequestDelegateFactory . Build ( @delegate ) ;
275+ var requestDelegate = RequestDelegateFactory . Create ( @delegate ) ;
276276
277277 await requestDelegate ( httpContext ) ;
278278
@@ -290,7 +290,7 @@ public async Task RequestDelegatePopulatesFromRouteOptionalParameterBasedOnParam
290290
291291 httpContext . Request . RouteValues [ paramName ] = originalRouteParam . ToString ( NumberFormatInfo . InvariantInfo ) ;
292292
293- var requestDelegate = RequestDelegateFactory . Build ( @delegate ) ;
293+ var requestDelegate = RequestDelegateFactory . Create ( @delegate ) ;
294294
295295 await requestDelegate ( httpContext ) ;
296296
@@ -313,7 +313,7 @@ void TestAction([FromRoute(Name = specifiedName)] int foo)
313313 var httpContext = new DefaultHttpContext ( ) ;
314314 httpContext . Request . RouteValues [ specifiedName ] = originalRouteParam . ToString ( NumberFormatInfo . InvariantInfo ) ;
315315
316- var requestDelegate = RequestDelegateFactory . Build ( ( Action < int > ) TestAction ) ;
316+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < int > ) TestAction ) ;
317317
318318 await requestDelegate ( httpContext ) ;
319319
@@ -336,7 +336,7 @@ void TestAction([FromRoute] int foo)
336336 var httpContext = new DefaultHttpContext ( ) ;
337337 httpContext . Request . RouteValues [ unmatchedName ] = unmatchedRouteParam . ToString ( NumberFormatInfo . InvariantInfo ) ;
338338
339- var requestDelegate = RequestDelegateFactory . Build ( ( Action < int > ) TestAction ) ;
339+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < int > ) TestAction ) ;
340340
341341 await requestDelegate ( httpContext ) ;
342342
@@ -364,7 +364,7 @@ void TestAction([FromQuery] int value)
364364 var httpContext = new DefaultHttpContext ( ) ;
365365 httpContext . Request . Query = query ;
366366
367- var requestDelegate = RequestDelegateFactory . Build ( ( Action < int > ) TestAction ) ;
367+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < int > ) TestAction ) ;
368368
369369 await requestDelegate ( httpContext ) ;
370370
@@ -387,7 +387,7 @@ void TestAction([FromHeader(Name = customHeaderName)] int value)
387387 var httpContext = new DefaultHttpContext ( ) ;
388388 httpContext . Request . Headers [ customHeaderName ] = originalHeaderParam . ToString ( NumberFormatInfo . InvariantInfo ) ;
389389
390- var requestDelegate = RequestDelegateFactory . Build ( ( Action < int > ) TestAction ) ;
390+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < int > ) TestAction ) ;
391391
392392 await requestDelegate ( httpContext ) ;
393393
@@ -415,7 +415,7 @@ void TestAction([FromBody] Todo todo)
415415 var requestBodyBytes = JsonSerializer . SerializeToUtf8Bytes ( originalTodo ) ;
416416 httpContext . Request . Body = new MemoryStream ( requestBodyBytes ) ;
417417
418- var requestDelegate = RequestDelegateFactory . Build ( ( Action < Todo > ) TestAction ) ;
418+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < Todo > ) TestAction ) ;
419419
420420 await requestDelegate ( httpContext ) ;
421421
@@ -434,7 +434,7 @@ void TestAction([FromBody] Todo todo)
434434 httpContext . Request . Headers [ "Content-Type" ] = "application/json" ;
435435 httpContext . Request . Headers [ "Content-Length" ] = "0" ;
436436
437- var requestDelegate = RequestDelegateFactory . Build ( ( Action < Todo > ) TestAction ) ;
437+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < Todo > ) TestAction ) ;
438438
439439 await Assert . ThrowsAsync < JsonException > ( ( ) => requestDelegate ( httpContext ) ) ;
440440 }
@@ -453,7 +453,7 @@ void TestAction([FromBody(AllowEmpty = true)] Todo todo)
453453 httpContext . Request . Headers [ "Content-Type" ] = "application/json" ;
454454 httpContext . Request . Headers [ "Content-Length" ] = "0" ;
455455
456- var requestDelegate = RequestDelegateFactory . Build ( ( Action < Todo > ) TestAction ) ;
456+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < Todo > ) TestAction ) ;
457457
458458 await requestDelegate ( httpContext ) ;
459459
@@ -477,7 +477,7 @@ void TestAction([FromBody(AllowEmpty = true)] BodyStruct bodyStruct)
477477 httpContext . Request . Headers [ "Content-Type" ] = "application/json" ;
478478 httpContext . Request . Headers [ "Content-Length" ] = "0" ;
479479
480- var requestDelegate = RequestDelegateFactory . Build ( ( Action < BodyStruct > ) TestAction ) ;
480+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < BodyStruct > ) TestAction ) ;
481481
482482 await requestDelegate ( httpContext ) ;
483483
@@ -507,7 +507,7 @@ void TestAction([FromBody] Todo todo)
507507 httpContext . Features . Set < IHttpRequestLifetimeFeature > ( new TestHttpRequestLifetimeFeature ( ) ) ;
508508 httpContext . RequestServices = serviceCollection . BuildServiceProvider ( ) ;
509509
510- var requestDelegate = RequestDelegateFactory . Build ( ( Action < Todo > ) TestAction ) ;
510+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < Todo > ) TestAction ) ;
511511
512512 await requestDelegate ( httpContext ) ;
513513
@@ -543,7 +543,7 @@ void TestAction([FromBody] Todo todo)
543543 httpContext . Features . Set < IHttpRequestLifetimeFeature > ( new TestHttpRequestLifetimeFeature ( ) ) ;
544544 httpContext . RequestServices = serviceCollection . BuildServiceProvider ( ) ;
545545
546- var requestDelegate = RequestDelegateFactory . Build ( ( Action < Todo > ) TestAction ) ;
546+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < Todo > ) TestAction ) ;
547547
548548 await requestDelegate ( httpContext ) ;
549549
@@ -578,7 +578,7 @@ void TestAction([FromForm] int value)
578578 var httpContext = new DefaultHttpContext ( ) ;
579579 httpContext . Request . Form = form ;
580580
581- var requestDelegate = RequestDelegateFactory . Build ( ( Action < int > ) TestAction ) ;
581+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < int > ) TestAction ) ;
582582
583583 await requestDelegate ( httpContext ) ;
584584
@@ -608,7 +608,7 @@ void TestAction([FromForm] int value)
608608 httpContext . Features . Set < IHttpRequestLifetimeFeature > ( new TestHttpRequestLifetimeFeature ( ) ) ;
609609 httpContext . RequestServices = serviceCollection . BuildServiceProvider ( ) ;
610610
611- var requestDelegate = RequestDelegateFactory . Build ( ( Action < int > ) TestAction ) ;
611+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < int > ) TestAction ) ;
612612
613613 await requestDelegate ( httpContext ) ;
614614
@@ -644,7 +644,7 @@ void TestAction([FromForm] int value)
644644 httpContext . Features . Set < IHttpRequestLifetimeFeature > ( new TestHttpRequestLifetimeFeature ( ) ) ;
645645 httpContext . RequestServices = serviceCollection . BuildServiceProvider ( ) ;
646646
647- var requestDelegate = RequestDelegateFactory . Build ( ( Action < int > ) TestAction ) ;
647+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < int > ) TestAction ) ;
648648
649649 await requestDelegate ( httpContext ) ;
650650
@@ -664,16 +664,16 @@ public void BuildRequestDelegateThrowsInvalidOperationExceptionGivenBothFromBody
664664 void TestAction ( [ FromBody ] int value1 , [ FromForm ] int value2 ) { }
665665 void TestActionWithFlippedParams ( [ FromForm ] int value1 , [ FromBody ] int value2 ) { }
666666
667- Assert . Throws < InvalidOperationException > ( ( ) => RequestDelegateFactory . Build ( ( Action < int , int > ) TestAction ) ) ;
668- Assert . Throws < InvalidOperationException > ( ( ) => RequestDelegateFactory . Build ( ( Action < int , int > ) TestActionWithFlippedParams ) ) ;
667+ Assert . Throws < InvalidOperationException > ( ( ) => RequestDelegateFactory . Create ( ( Action < int , int > ) TestAction ) ) ;
668+ Assert . Throws < InvalidOperationException > ( ( ) => RequestDelegateFactory . Create ( ( Action < int , int > ) TestActionWithFlippedParams ) ) ;
669669 }
670670
671671 [ Fact ]
672672 public void BuildRequestDelegateThrowsInvalidOperationExceptionGivenFromBodyOnMultipleParameters ( )
673673 {
674674 void TestAction ( [ FromBody ] int value1 , [ FromBody ] int value2 ) { }
675675
676- Assert . Throws < InvalidOperationException > ( ( ) => RequestDelegateFactory . Build ( ( Action < int , int > ) TestAction ) ) ;
676+ Assert . Throws < InvalidOperationException > ( ( ) => RequestDelegateFactory . Create ( ( Action < int , int > ) TestAction ) ) ;
677677 }
678678
679679 [ Fact ]
@@ -693,7 +693,7 @@ void TestAction([FromService] MyService myService)
693693 var httpContext = new DefaultHttpContext ( ) ;
694694 httpContext . RequestServices = serviceCollection . BuildServiceProvider ( ) ;
695695
696- var requestDelegate = RequestDelegateFactory . Build ( ( Action < MyService > ) TestAction ) ;
696+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < MyService > ) TestAction ) ;
697697
698698 await requestDelegate ( httpContext ) ;
699699
@@ -712,7 +712,7 @@ void TestAction(HttpContext httpContext)
712712
713713 var httpContext = new DefaultHttpContext ( ) ;
714714
715- var requestDelegate = RequestDelegateFactory . Build ( ( Action < HttpContext > ) TestAction ) ;
715+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < HttpContext > ) TestAction ) ;
716716
717717 await requestDelegate ( httpContext ) ;
718718
@@ -732,7 +732,7 @@ void TestAction(IFormCollection httpContext)
732732 var httpContext = new DefaultHttpContext ( ) ;
733733 httpContext . Request . Headers [ "Content-Type" ] = "application/x-www-form-urlencoded" ;
734734
735- var requestDelegate = RequestDelegateFactory . Build ( ( Action < IFormCollection > ) TestAction ) ;
735+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < IFormCollection > ) TestAction ) ;
736736
737737 await requestDelegate ( httpContext ) ;
738738
@@ -755,7 +755,7 @@ void TestAction(CancellationToken cancellationToken)
755755 RequestAborted = cts . Token
756756 } ;
757757
758- var requestDelegate = RequestDelegateFactory . Build ( ( Action < CancellationToken > ) TestAction ) ;
758+ var requestDelegate = RequestDelegateFactory . Create ( ( Action < CancellationToken > ) TestAction ) ;
759759
760760 await requestDelegate ( httpContext ) ;
761761
@@ -799,7 +799,7 @@ public async Task RequestDelegateWritesComplexReturnValueAsJsonResponseBody(Dele
799799 var responseBodyStream = new MemoryStream ( ) ;
800800 httpContext . Response . Body = responseBodyStream ;
801801
802- var requestDelegate = RequestDelegateFactory . Build ( @delegate ) ;
802+ var requestDelegate = RequestDelegateFactory . Create ( @delegate ) ;
803803
804804 await requestDelegate ( httpContext ) ;
805805
@@ -848,7 +848,7 @@ public async Task RequestDelegateUsesCustomIResult(Delegate @delegate)
848848 var responseBodyStream = new MemoryStream ( ) ;
849849 httpContext . Response . Body = responseBodyStream ;
850850
851- var requestDelegate = RequestDelegateFactory . Build ( @delegate ) ;
851+ var requestDelegate = RequestDelegateFactory . Create ( @delegate ) ;
852852
853853 await requestDelegate ( httpContext ) ;
854854
@@ -891,7 +891,7 @@ public async Task RequestDelegateWritesStringReturnValueAsJsonResponseBody(Deleg
891891 var responseBodyStream = new MemoryStream ( ) ;
892892 httpContext . Response . Body = responseBodyStream ;
893893
894- var requestDelegate = RequestDelegateFactory . Build ( @delegate ) ;
894+ var requestDelegate = RequestDelegateFactory . Create ( @delegate ) ;
895895
896896 await requestDelegate ( httpContext ) ;
897897
@@ -932,7 +932,7 @@ public async Task RequestDelegateWritesIntReturnValue(Delegate @delegate)
932932 var responseBodyStream = new MemoryStream ( ) ;
933933 httpContext . Response . Body = responseBodyStream ;
934934
935- var requestDelegate = RequestDelegateFactory . Build ( @delegate ) ;
935+ var requestDelegate = RequestDelegateFactory . Create ( @delegate ) ;
936936
937937 await requestDelegate ( httpContext ) ;
938938
@@ -973,7 +973,7 @@ public async Task RequestDelegateWritesBoolReturnValue(Delegate @delegate)
973973 var responseBodyStream = new MemoryStream ( ) ;
974974 httpContext . Response . Body = responseBodyStream ;
975975
976- var requestDelegate = RequestDelegateFactory . Build ( @delegate ) ;
976+ var requestDelegate = RequestDelegateFactory . Create ( @delegate ) ;
977977
978978 await requestDelegate ( httpContext ) ;
979979
0 commit comments