XBullet.EasyTesting 1.0.12

There is a newer version of this package available.
See the version list below for details.
dotnet add package XBullet.EasyTesting --version 1.0.12
                    
NuGet\Install-Package XBullet.EasyTesting -Version 1.0.12
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="XBullet.EasyTesting" Version="1.0.12" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="XBullet.EasyTesting" Version="1.0.12" />
                    
Directory.Packages.props
<PackageReference Include="XBullet.EasyTesting" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add XBullet.EasyTesting --version 1.0.12
                    
#r "nuget: XBullet.EasyTesting, 1.0.12"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package XBullet.EasyTesting@1.0.12
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=XBullet.EasyTesting&version=1.0.12
                    
Install as a Cake Addin
#tool nuget:?package=XBullet.EasyTesting&version=1.0.12
                    
Install as a Cake Tool

XBullet.EasyTesting

Reusable infrastructure for integration-testing authenticated ASP.NET Core applications through an in-memory TestServer.

The package targets .NET 8, .NET 9, 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.

To keep the application's real default authentication scheme, configure PreserveDefaultAuthenticationScheme().MapTestAuthentication("IntegrationTest") and select the named scheme with AsUser(..., authenticationScheme: "IntegrationTest"). This supports a hybrid test project: use simulated principals for authorization and business behavior, and real ASP.NET Core Identity endpoints and handlers for registration, login, passwords, and token lifecycle. To let both identity types use the same plain RequireAuthorization() endpoint, configure UseHybridDefaultAuthentication("IntegrationTest"); requests carrying XBullet's test-identity header use the simulated scheme, other requests use the application's original default scheme, and the original challenge and forbid handlers remain active. This behavior is opt-in. SeedIdentityUserAsync persists users through UserManager<TUser>, CreateIdentityTestUserAsync creates linked simulated users, and WithBearerToken sends real Identity bearer tokens without JWT-specific test configuration. Identity stores without role or claim support produce linked simulated users with empty role or claim collections.

Use EasyTestHost.Create<Program>().UseSetting(key, value) for connection strings and other values read immediately after WebApplication.CreateBuilder; these early settings are visible before minimal-hosting startup code consumes them.

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 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 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
1.0.13 0 9/26/2026
1.0.12 35 9/25/2026
1.0.11 60 9/24/2026
1.0.9 59 9/24/2026
1.0.8 220 9/21/2026
1.0.7 222 9/19/2026
1.0.6 215 9/18/2026
1.0.5 213 9/18/2026
1.0.4 209 9/15/2026
1.0.3 155 9/15/2026
0.2.0 165 9/15/2026
0.1.0 97 9/14/2026