1- using Microsoft . AspNetCore . Hosting ;
1+ using System . Text . Json ;
2+ using Microsoft . AspNetCore . Hosting ;
23
34namespace Tests . SayHello ;
45
56public class App : AppFixture < Program >
67{
78 protected override ValueTask SetupAsync ( )
89 {
9- // place one-time setup for the fixture here
10+ // place one-time setup for the fixture here.
11+
1012 return ValueTask . CompletedTask ;
1113 }
1214
1315 protected override void ConfigureApp ( IWebHostBuilder a )
1416 {
15- // do host builder configuration here
17+ // do host builder configuration here.
18+ // only called when running under WAF mode.
1619 }
1720
1821 protected override void ConfigureServices ( IServiceCollection s )
1922 {
20- // do test service registration here
23+ // do test service registration here.
24+ // only called when running under WAF mode.
25+ }
26+
27+ protected override ValueTask ConfigureAotTargetAsync ( AotTargetOptions o )
28+ {
29+ // settings for building and running a native aot black-box instance.
30+ // all settings are optional. customization only needed if auto management fails.
31+
32+ o . BuildTimeoutMinutes = 1 ;
33+ o . HealthEndpointPath = "/healthy" ;
34+ o . ReadyTimeoutSeconds = 5 ;
35+ o . EnvironmentVariables [ "ASPNETCORE_ENVIRONMENT" ] = "Testing" ;
36+
37+ // make routeless test helpers use the same serializer settings as the app
38+
39+ new Config ( ) . Serializer . Options . PropertyNamingPolicy = JsonNamingPolicy . CamelCase ;
40+
41+ return ValueTask . CompletedTask ;
2142 }
2243
2344 protected override ValueTask TearDownAsync ( )
2445 {
2546 // do cleanups here
47+
2648 return ValueTask . CompletedTask ;
2749 }
2850}
0 commit comments