Skip to content

Commit

Permalink
chore: update example to .NET 8, bump its dependencies and fix deprec…
Browse files Browse the repository at this point in the history
…ations
  • Loading branch information
skwasjer committed Sep 5, 2024
1 parent 7af7e7f commit aa5af4b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions examples/Minimal API/MyWebApp.Tests/MyWebApp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="skwas.MockHttp.Json" Version="4.0.1" />
<PackageReference Include="skwas.MockHttp.Server" Version="4.0.1" />
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.8" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="skwas.MockHttp.Json" Version="4.3.1" />
<PackageReference Include="skwas.MockHttp.Server" Version="4.3.1" />
<PackageReference Include="xunit" Version="2.9.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions examples/Minimal API/MyWebApp.Tests/SmokeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task TestEndpoint()
// Configure HTTP mock.
using MockHttpHandler mockHttpHandler = HttpMocks.CreateMyClientMock();
// We create a server with automatic port binding (0) on localhost, but you may also define a static port. Note that the port must be free!
using var mockHttpServer = new MockHttpServer(mockHttpHandler, "http://127.0.0.1:0");
await using var mockHttpServer = new MockHttpServer(mockHttpHandler, new Uri("http://127.0.0.1:0"));

await mockHttpServer.StartAsync();

Expand All @@ -33,7 +33,7 @@ public async Task TestEndpoint()
// Here we override the base URL configured for the API client with the one from the server stub.
builder.ConfigureServices(services => services
// ReSharper disable once AccessToDisposedClosure
.Configure<MyClientOptions>(opts => opts.BaseUrl = new Uri(mockHttpServer.HostUrl))
.Configure<MyClientOptions>(opts => opts.BaseUrl = mockHttpServer.HostUri)
);
});

Expand Down
2 changes: 1 addition & 1 deletion examples/Minimal API/MyWebApp/MyWebApp.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PreserveCompilationContext>true</PreserveCompilationContext>
Expand Down

0 comments on commit aa5af4b

Please sign in to comment.