net8.0net9.0
Experimental package. Test fakes for integration testing
Published
Apr 11, 2024
2y ago
Total Downloads
125.2K
125,194
Install
dotnet add package Microsoft.AspNetCore.Testing --version 9.0.0-preview.3.24209.3
| Product | Versions |
|---|---|
| .NET |
README
Microsoft.AspNetCore.Testing
This package provides test fakes for integration testing of ASP.NET Core applications.
In particular:
IWebHostBuilderextensions to setup the test web app.IHostextensions to access that test web app.
Install the package
From the command-line:
dotnet add package Microsoft.AspNetCore.Testing
Or directly in the C# project file:
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Testing" Version="[CURRENTVERSION]" />
</ItemGroup>
Usage Example
Creating a Test Web App
The IWebHostBuilder extensions can help set up a host for testing.
using var host = await FakeHost.CreateBuilder()
.ConfigureWebHost(webHost => webHost.UseFakeStartup().ListenHttpOnAnyPort())
.StartAsync();
Accessing the test Web App
The IHost extensions can help access the test host that was created above.
using var client = host.CreateClient();
var response = await client.GetAsync("/");
Feedback & Contributing
We welcome feedback and contributions in our GitHub repo.
Changes from Previous Version
No structural changes between v9.0.0-preview.2.24157.4 and v9.0.0-preview.3.24209.3.
Adoption Assessment
A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.
This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 2 target frameworks; confirm the exact target used by your application.
Related Guides & Workflows
Learn how to evaluate, integrate, or audit this package in your .NET project.