@@ -4268,7 +4268,6 @@ public async Task RequestDelegateFactory_InvokesFilters_OnDelegateWithTarget()
4268
4268
{
4269
4269
( routeHandlerContext , next ) => async ( context ) =>
4270
4270
{
4271
- Console . WriteLine ( context . Parameters [ 0 ] ) ;
4272
4271
return await next ( context ) ;
4273
4272
}
4274
4273
}
@@ -4286,7 +4285,7 @@ string GetString(string name)
4286
4285
}
4287
4286
4288
4287
[ Fact ]
4289
- public async Task RequestDelegateFactory_InvokesFilters_OnMethodInfoWithTargetFactory ( )
4288
+ public async Task RequestDelegateFactory_InvokesFilters_OnMethodInfoWithNullTargetFactory ( )
4290
4289
{
4291
4290
// Arrange
4292
4291
var methodInfo = typeof ( RequestDelegateFactoryTests ) . GetMethod (
@@ -4304,17 +4303,17 @@ public async Task RequestDelegateFactory_InvokesFilters_OnMethodInfoWithTargetFa
4304
4303
{
4305
4304
RouteHandlerFilterFactories = new List < Func < RouteHandlerContext , RouteHandlerFilterDelegate , RouteHandlerFilterDelegate > > ( )
4306
4305
{
4307
- ( routeHandlerContext , next ) => ( context ) =>
4306
+ ( routeHandlerContext , next ) => async ( context ) =>
4308
4307
{
4309
- return ValueTask . FromResult < object ? > ( Results . Created ( "/foo" , "Great!" ) ) ;
4308
+ return await next ( context ) ;
4310
4309
}
4311
4310
}
4312
4311
} ) ;
4313
4312
var requestDelegate = factoryResult . RequestDelegate ;
4314
4313
await requestDelegate ( httpContext ) ;
4315
4314
4316
4315
// Assert
4317
- Assert . Equal ( 201 , httpContext . Response . StatusCode ) ;
4316
+ Assert . Equal ( 200 , httpContext . Response . StatusCode ) ;
4318
4317
}
4319
4318
4320
4319
[ Fact ]
@@ -4337,23 +4336,23 @@ public async Task RequestDelegateFactory_InvokesFilters_OnMethodInfoWithProvided
4337
4336
{
4338
4337
invoked = true ;
4339
4338
context . Items [ "invoked" ] = true ;
4340
- return methodInfo ! . DeclaringType ! ;
4339
+ return Activator . CreateInstance ( methodInfo ! . DeclaringType ! ) ;
4341
4340
} ;
4342
4341
var factoryResult = RequestDelegateFactory . Create ( methodInfo ! , targetFactory , new RequestDelegateFactoryOptions ( )
4343
4342
{
4344
4343
RouteHandlerFilterFactories = new List < Func < RouteHandlerContext , RouteHandlerFilterDelegate , RouteHandlerFilterDelegate > > ( )
4345
4344
{
4346
- ( routeHandlerContext , next ) => ( context ) =>
4345
+ ( routeHandlerContext , next ) => async ( context ) =>
4347
4346
{
4348
- return ValueTask . FromResult < object ? > ( Results . Created ( "/foo" , "Great!" ) ) ;
4347
+ return await next ( context ) ;
4349
4348
}
4350
4349
}
4351
4350
} ) ;
4352
4351
var requestDelegate = factoryResult . RequestDelegate ;
4353
4352
await requestDelegate ( httpContext ) ;
4354
4353
4355
4354
// Assert
4356
- Assert . Equal ( 201 , httpContext . Response . StatusCode ) ;
4355
+ Assert . Equal ( 200 , httpContext . Response . StatusCode ) ;
4357
4356
Assert . True ( invoked ) ;
4358
4357
var invokedInContext = Assert . IsType < bool > ( httpContext . Items [ "invoked" ] ) ;
4359
4358
Assert . True ( invokedInContext ) ;
0 commit comments