Skip to content

Commit ec769ea

Browse files
claudiamurialdoBeta Bot
authored andcommitted
Cherry pick branch 'genexuslabs:feat/net10' into beta
1 parent d32975a commit ec769ea

File tree

2 files changed

+3
-18
lines changed

2 files changed

+3
-18
lines changed

dotnet/test/DotNetCoreWebUnitTest/DotNetCoreWebUnitTest.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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>

dotnet/test/DotNetCoreWebUnitTest/Middleware/MiddlewareTest.cs

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using Microsoft.AspNetCore;
88
using Microsoft.AspNetCore.Hosting;
99
using Microsoft.AspNetCore.TestHost;
10-
using Microsoft.Extensions.Hosting;
1110

1211
namespace 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

0 commit comments

Comments
 (0)