File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
src/DefaultBuilder/test/Microsoft.AspNetCore.Tests Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -1372,6 +1372,37 @@ public async Task NoExceptionAreThrownForBadRequestsInProduction()
13721372 Assert . Equal ( string . Empty , responseBody ) ;
13731373 }
13741374
1375+ [ Fact ]
1376+ public void PropertiesArePropagated ( )
1377+ {
1378+ var builder = WebApplication . CreateBuilder ( ) ;
1379+ builder . Host . Properties [ "hello" ] = "world" ;
1380+ var callbacks = 0 ;
1381+
1382+ builder . Host . ConfigureAppConfiguration ( ( context , config ) =>
1383+ {
1384+ callbacks |= 0b00000001 ;
1385+ Assert . Equal ( "world" , context . Properties [ "hello" ] ) ;
1386+ } ) ;
1387+
1388+ builder . Host . ConfigureServices ( ( context , config ) =>
1389+ {
1390+ callbacks |= 0b00000010 ;
1391+ Assert . Equal ( "world" , context . Properties [ "hello" ] ) ;
1392+ } ) ;
1393+
1394+ builder . Host . ConfigureContainer < IServiceCollection > ( ( context , config ) =>
1395+ {
1396+ callbacks |= 0b00000100 ;
1397+ Assert . Equal ( "world" , context . Properties [ "hello" ] ) ;
1398+ } ) ;
1399+
1400+ using var app = builder . Build ( ) ;
1401+
1402+ // Make sure all of the callbacks ran
1403+ Assert . Equal ( 0b00000111 , callbacks ) ;
1404+ }
1405+
13751406 [ Fact ]
13761407 public void HostConfigurationNotAffectedByConfiguration ( )
13771408 {
You can’t perform that action at this time.
0 commit comments