File tree Expand file tree Collapse file tree 2 files changed +27
-42
lines changed
test/ZNetCS.AspNetCore.Authentication.BasicTests Expand file tree Collapse file tree 2 files changed +27
-42
lines changed Original file line number Diff line number Diff line change @@ -24,35 +24,28 @@ namespace ZNetCS.AspNetCore.Authentication.BasicTests;
2424internal class EmptyWebApplicationFactory : WebApplicationFactory < EmptyStartup >
2525{
2626 /// <inheritdoc/>
27- protected override IHostBuilder CreateHostBuilder ( )
28- {
29- return Host . CreateDefaultBuilder ( )
30- . ConfigureWebHostDefaults (
31- builder =>
32- {
33- builder . ConfigureServices ( s => { s . AddMvc ( ) ; } )
34- . Configure (
35- app =>
36- {
37- app . UseRouting ( ) ;
38- app . UseAuthentication ( ) ;
39- app . UseAuthorization ( ) ;
40- app . UseEndpoints ( o => o . MapControllers ( ) ) ;
41- } )
42- . ConfigureLogging (
43- ( _ , logging ) =>
44- {
45- logging
46- . AddFilter ( "Default" , LogLevel . Debug )
47- . AddDebug ( ) ;
48- } ) ;
49- } ) ;
50- }
27+ protected override IHostBuilder CreateHostBuilder ( ) => Host . CreateDefaultBuilder ( ) . ConfigureWebHostDefaults ( _ => { } ) ;
5128
5229 /// <inheritdoc />
5330 protected override void ConfigureWebHost ( IWebHostBuilder builder )
5431 {
5532 builder . UseContentRoot ( GetPath ( ) ?? string . Empty ) ;
33+ builder . ConfigureServices ( s => { s . AddMvc ( ) ; } ) ;
34+ builder . Configure (
35+ app =>
36+ {
37+ app . UseRouting ( ) ;
38+ app . UseAuthentication ( ) ;
39+ app . UseAuthorization ( ) ;
40+ app . UseEndpoints ( o => o . MapControllers ( ) ) ;
41+ } ) ;
42+ builder . ConfigureLogging (
43+ ( _ , logging ) =>
44+ {
45+ logging
46+ . AddFilter ( "Default" , LogLevel . Debug )
47+ . AddDebug ( ) ;
48+ } ) ;
5649 }
5750
5851 /// <summary>
Original file line number Diff line number Diff line change 66
77namespace ZNetCS . AspNetCore . Authentication . BasicTests ;
88
9- #region Usings
9+ #region Usings
1010
1111using System . IO ;
1212using System . Reflection ;
@@ -24,28 +24,20 @@ namespace ZNetCS.AspNetCore.Authentication.BasicTests;
2424internal class StartupWebApplicationFactory : WebApplicationFactory < Startup >
2525{
2626 /// <inheritdoc/>
27- protected override IHostBuilder CreateHostBuilder ( )
28- {
29- return Host . CreateDefaultBuilder ( )
30- . ConfigureWebHostDefaults (
31- builder =>
32- {
33- builder
34- . UseStartup < Startup > ( )
35- . ConfigureLogging (
36- ( _ , logging ) =>
37- {
38- logging
39- . AddFilter ( "Default" , LogLevel . Debug )
40- . AddDebug ( ) ;
41- } ) ;
42- } ) ;
43- }
27+ protected override IHostBuilder CreateHostBuilder ( ) => Host . CreateDefaultBuilder ( ) . ConfigureWebHostDefaults ( _ => { } ) ;
4428
4529 /// <inheritdoc />
4630 protected override void ConfigureWebHost ( IWebHostBuilder builder )
4731 {
4832 builder . UseContentRoot ( GetPath ( ) ?? string . Empty ) ;
33+ builder . UseStartup < Startup > ( ) ;
34+ builder . ConfigureLogging (
35+ ( _ , logging ) =>
36+ {
37+ logging
38+ . AddFilter ( "Default" , LogLevel . Debug )
39+ . AddDebug ( ) ;
40+ } ) ;
4941 }
5042
5143 /// <summary>
You can’t perform that action at this time.
0 commit comments