XBullet.EasyTesting
1.0.5
See the version list below for details.
dotnet add package XBullet.EasyTesting --version 1.0.5
NuGet\Install-Package XBullet.EasyTesting -Version 1.0.5
<PackageReference Include="XBullet.EasyTesting" Version="1.0.5" />
<PackageVersion Include="XBullet.EasyTesting" Version="1.0.5" />
<PackageReference Include="XBullet.EasyTesting" />
paket add XBullet.EasyTesting --version 1.0.5
#r "nuget: XBullet.EasyTesting, 1.0.5"
#:package XBullet.EasyTesting@1.0.5
#addin nuget:?package=XBullet.EasyTesting&version=1.0.5
#tool nuget:?package=XBullet.EasyTesting&version=1.0.5
XBullet.EasyTesting
Reusable infrastructure for integration-testing authenticated ASP.NET Core applications through an in-memory TestServer.
The package targets .NET 8 and .NET 10.
Install
dotnet add package XBullet.EasyTesting
Example
using var factory = EasyTestHost.Create<Program>()
.ConfigureServices(services =>
{
services.RemoveAll<IClock>();
services.AddSingleton<IClock>(new FakeClock());
})
.Build();
using var client = factory.Client()
.AsUser(user => user
.WithName("Ada")
.WithRole("Administrator"))
.Build();
using var response = await client.GetAsync("/api/orders");
response.EnsureSuccessStatusCode();
The fluent host also supports configuration overrides, authentication profiles, per-test scenario isolation, and arrange-and-request workflows. Scenario results provide test-framework-agnostic status, header, success, and generic structural JSON body assertions through result.Should().
For an existing IntegrationTestStartup pipeline, derive from
StartupAuthenticatedWebApplicationFactory<IntegrationTestStartup>. It creates a TestServer
directly without invoking Program.Main, while retaining configuration and scenario overrides.
Map a Federation scheme with MapFederation, then use AsFederatedUser to create a primary
Federation identity plus an additional ApiUserIdentity-shaped identity. Applications that need
a concrete custom identity subclass can replace ITestClaimsPrincipalFactory with a derived
TestClaimsPrincipalFactory.
External dependencies that need asynchronous startup can implement
ITestScenarioEnvironmentResource. Register a new resource for each scenario with
ConfigureEnvironment, or register an existing scenario-owned instance through
TestScenarioScopeBuilder.UseEnvironmentResource. Resources start before the application host,
can add configuration and services after their endpoint is known, participate in failure
diagnostics, and are disposed after the scenario host.
See the repository documentation for complete examples.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 10.0.11)
- Microsoft.AspNetCore.Mvc.Testing (>= 10.0.11)
-
net8.0
- Microsoft.AspNetCore.Authentication.JwtBearer (>= 8.0.30)
- Microsoft.AspNetCore.Mvc.Testing (>= 8.0.31)
NuGet packages (7)
Showing the top 5 NuGet packages that depend on XBullet.EasyTesting:
| Package | Downloads |
|---|---|
|
XBullet.EasyTesting.Http
Fluent outbound HTTP stubs for integration-test hosts. |
|
|
XBullet.EasyTesting.EntityFrameworkCore
Generic Entity Framework Core database actions for authenticated integration-test hosts. |
|
|
XBullet.EasyTesting.Messaging
Transport-neutral message recording for integration-test hosts. |
|
|
XBullet.EasyTesting.Azure
Deterministic Azure SDK responses, credentials, paging, and pipeline transport for tests. |
|
|
XBullet.EasyTesting.Aspire
Closed-box distributed application testing helpers for Aspire. |
GitHub repositories
This package is not used by any popular GitHub repositories.