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" />
                    
Directory.Packages.props
<PackageReference Include="SimpleModule.Testing" />
                    
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 SimpleModule.Testing --version 0.0.36
                    
#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
                    
Install as a Cake Addin
#tool nuget:?package=SimpleModule.Testing&version=0.0.36
                    
Install as a Cake Tool

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 of type=value claims into an authenticated ClaimsPrincipal.
  • 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[]) and factory.CreateAuthenticatedClient(string[] permissions, params Claim[]) extensions on WebApplicationFactory<TEntryPoint> that produce HTTP clients with the appropriate X-Test-Claims header.

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 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.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.36 80 5/1/2026
0.0.35 79 4/30/2026