SimpleModule.Testing
0.0.36
dotnet add package SimpleModule.Testing --version 0.0.36
NuGet\Install-Package SimpleModule.Testing -Version 0.0.36
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="SimpleModule.Testing" Version="0.0.36" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SimpleModule.Testing" Version="0.0.36" />
<PackageReference Include="SimpleModule.Testing" />
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 SimpleModule.Testing --version 0.0.36
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: SimpleModule.Testing, 0.0.36"
#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 SimpleModule.Testing@0.0.36
#: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=SimpleModule.Testing&version=0.0.36
#tool nuget:?package=SimpleModule.Testing&version=0.0.36
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
SimpleModule.Testing
Reusable integration-test helpers for SimpleModule applications.
What's in the box
TestAuthHandler— header-based test auth handler that turns a semicolon-separated list oftype=valueclaims into an authenticatedClaimsPrincipal.TestAuthDefaults— scheme name (TestScheme) and header name (X-Test-Claims) constants.services.AddTestAuthentication()— registers the handler as the default authenticate/challenge scheme.factory.CreateAuthenticatedClient(params Claim[])andfactory.CreateAuthenticatedClient(string[] permissions, params Claim[])extensions onWebApplicationFactory<TEntryPoint>that produce HTTP clients with the appropriateX-Test-Claimsheader.
Usage
using SimpleModule.Testing;
public sealed class MyAppFactory : WebApplicationFactory<Program>
{
protected override void ConfigureWebHost(IWebHostBuilder builder)
{
builder.ConfigureServices(services =>
{
services.AddTestAuthentication();
});
}
}
public sealed class MyEndpointTests(MyAppFactory factory) : IClassFixture<MyAppFactory>
{
[Fact]
public async Task Authenticated_request_succeeds()
{
var client = factory.CreateAuthenticatedClient(
new Claim("permission", "Things.View")
);
var response = await client.GetAsync("/api/things");
response.EnsureSuccessStatusCode();
}
}
This package is intentionally narrow: it ships only the auth-related plumbing.
Wire your own WebApplicationFactory for module-specific setup (DB swap,
hosted-service removal, etc.).
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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.
-
net10.0
- Microsoft.AspNetCore.Mvc.Testing (>= 10.0.3)
- SimpleModule.Core (>= 0.0.36)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.