File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
src/Http/Routing/test/UnitTests Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 10
10
using Microsoft . AspNetCore . Routing . Matching ;
11
11
using Microsoft . AspNetCore . Routing . TestObjects ;
12
12
using Microsoft . AspNetCore . Testing ;
13
+ using Microsoft . Extensions . DependencyInjection ;
13
14
using Microsoft . Extensions . Logging ;
14
15
using Microsoft . Extensions . Logging . Abstractions ;
15
16
using Microsoft . Extensions . Logging . Testing ;
@@ -393,6 +394,36 @@ public async Task Endpoint_HasBodySizeFeature_SetUsingSizeLimitMetadata(bool isR
393
394
Assert . Equal ( expectedRequestSizeLimit , actualRequestSizeLimit ) ;
394
395
}
395
396
397
+ [ Fact ]
398
+ public async Task Create_WithoutHostBuilder_Success ( )
399
+ {
400
+ // Arrange
401
+ var httpContext = CreateHttpContext ( ) ;
402
+
403
+ var services = new ServiceCollection ( ) ;
404
+ services . AddLogging ( ) ;
405
+ services . AddOptions ( ) ;
406
+ services . AddSingleton < DiagnosticListener > ( s => new DiagnosticListener ( "Test" ) ) ;
407
+ services . AddRouting ( ) ;
408
+
409
+ var applicationBuilder = new ApplicationBuilder ( services . BuildServiceProvider ( ) ) ;
410
+
411
+ applicationBuilder . UseRouting ( ) ;
412
+ applicationBuilder . UseEndpoints ( endpoints =>
413
+ {
414
+ endpoints . MapGet ( "/" , ( HttpContext c ) => Task . CompletedTask ) ;
415
+ } ) ;
416
+
417
+ var requestDelegate = applicationBuilder . Build ( ) ;
418
+
419
+ // Act
420
+ await requestDelegate ( httpContext ) ;
421
+
422
+ // Assert
423
+ var endpointFeature = httpContext . Features . Get < IEndpointFeature > ( ) ;
424
+ Assert . NotNull ( endpointFeature ) ;
425
+ }
426
+
396
427
private class RequestSizeLimitMetadata ( long ? maxRequestBodySize ) : IRequestSizeLimitMetadata
397
428
{
398
429
You can’t perform that action at this time.
0 commit comments