File tree Expand file tree Collapse file tree 2 files changed +3
-18
lines changed
dotnet/test/DotNetCoreWebUnitTest Expand file tree Collapse file tree 2 files changed +3
-18
lines changed Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22 <PropertyGroup >
3- <TargetFrameworks >net8.0;net10.0 </TargetFrameworks >
3+ <TargetFrameworks >net8.0</TargetFrameworks >
44 <NoWarn >CS8032;1701;1702;NU1701</NoWarn >
55 <RollForward >Major</RollForward >
66 </PropertyGroup >
Original file line number Diff line number Diff line change 77using Microsoft . AspNetCore ;
88using Microsoft . AspNetCore . Hosting ;
99using Microsoft . AspNetCore . TestHost ;
10- using Microsoft . Extensions . Hosting ;
1110
1211namespace xUnitTesting
1312{
@@ -20,25 +19,11 @@ public MiddlewareTest()
2019 {
2120 SetEnvironmentVars ( ) ;
2221 BeforeStartup ( ) ;
23-
22+ server = new TestServer ( WebHost . CreateDefaultBuilder ( ) . UseStartup < Startup > ( ) . UseEnvironment ( DOTNET_ENVIRONMENT ) ) ;
2423 GXRouting . ContentRootPath = Directory . GetCurrentDirectory ( ) ;
25-
26- var hostBuilder = Host . CreateDefaultBuilder ( ) . ConfigureWebHostDefaults ( webBuilder =>
27- {
28- webBuilder
29- . UseStartup < Startup > ( )
30- . UseEnvironment ( DOTNET_ENVIRONMENT )
31- . UseContentRoot ( GXRouting . ContentRootPath )
32- . UseTestServer ( ) ;
33- } ) ;
34-
35- var host = hostBuilder . Start ( ) ;
36-
37- server = host . GetTestServer ( ) ;
38- server . PreserveExecutionContext = true ;
24+ server . PreserveExecutionContext = true ;
3925 server . CreateClient ( ) ;
4026 }
41-
4227 protected virtual void SetEnvironmentVars ( )
4328 {
4429
You can’t perform that action at this time.
0 commit comments