AsiBackbone.Testing 2.0.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package AsiBackbone.Testing --version 2.0.2
                    
NuGet\Install-Package AsiBackbone.Testing -Version 2.0.2
                    
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="AsiBackbone.Testing" Version="2.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AsiBackbone.Testing" Version="2.0.2" />
                    
Directory.Packages.props
<PackageReference Include="AsiBackbone.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 AsiBackbone.Testing --version 2.0.2
                    
#r "nuget: AsiBackbone.Testing, 2.0.2"
                    
#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 AsiBackbone.Testing@2.0.2
                    
#: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=AsiBackbone.Testing&version=2.0.2
                    
Install as a Cake Addin
#tool nuget:?package=AsiBackbone.Testing&version=2.0.2
                    
Install as a Cake Tool

AsiBackbone.Testing

AsiBackbone.Testing provides test harness helpers for exercising AsiBackbone-governed endpoints and services without forcing host applications to wire production persistence, signing, outbox, audit, or capability-grant infrastructure in every automated test.

This package is for tests only. It is not a production enforcement provider and should not be used to weaken host-owned governance, persistence, signing, audit, or capability validation in production applications.

What it registers

AddAsiBackboneTestHarness(...) registers deterministic test-only substitutions for common host-owned seams:

  • IAsiBackbonePolicyEvaluator<AsiBackboneConstraintEvaluationContext>
  • IAsiBackboneEndpointCapabilityGrantValidator
  • IAsiBackboneAuditSink backed by AsiBackboneTestAuditSink
  • IAsiBackboneGovernanceOutboxStore backed by the non-durable in-memory outbox store
  • IAsiBackboneSigningService backed by a deterministic no-signature service

The package does not change production package defaults. ASP.NET Core endpoint governance remains fail-closed when host-owned services are missing unless tests explicitly register this harness.

Basic endpoint test setup

using AsiBackbone.AspNetCore.DependencyInjection;
using AsiBackbone.Testing;

builder.Services
    .AddAsiBackboneAspNetCore()
    .AddAsiBackboneTestHarness(harness =>
    {
        harness.AllowAllPolicies();
        harness.AllowCapabilityGrants();
    });

Deterministic policy results

builder.Services.AddAsiBackboneTestHarness(harness =>
{
    harness.AllowAllPolicies();
    harness.SetPolicyResult<MyStrictPolicy>(
        GovernanceDecision.Deny("test.denied", "Denied by test harness."));
});

For stricter tests, require every policy marker to have an explicit result:

builder.Services.AddAsiBackboneTestHarness(harness =>
{
    harness.RequirePolicyResult<MyStrictPolicy>(GovernanceDecision.Allow());
});

When RequirePolicyResult<TPolicy>(...) is used and the selected endpoint has an unconfigured policy marker, the harness returns a deterministic denied decision with reason code test_harness.policy_result.missing.

Inspecting audit residue

AsiBackboneTestAuditSink auditSink = services.GetRequiredService<AsiBackboneTestAuditSink>();

Assert.Single(auditSink.Entries);

The audit sink is in-memory and process-local. It is intended for assertion-friendly automated tests, not durable records or tamper-evidence.

WebApplicationFactory-style usage

factory.WithWebHostBuilder(builder =>
{
    builder.ConfigureServices(services =>
    {
        services.AddAsiBackboneTestHarness(harness =>
        {
            harness.AllowAllPolicies();
            harness.AllowCapabilityGrants();
        });
    });
});

Use this pattern when a host application already calls AddAsiBackboneAspNetCore() and exposes endpoints with metadata such as .RequireGovernancePolicy<TPolicy>(), .RequireCapabilityGrant(...), or .EmitGovernanceAudit().

Production boundary

This package is intentionally scoped to automated tests, samples, and local developer validation. Production applications should register real policy evaluators, capability validators, audit sinks, durable outbox stores, signing providers, and storage providers appropriate to their risk profile.

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
2.2.0 44 7/1/2026
2.1.1 92 6/29/2026
2.1.0 91 6/28/2026
2.0.2 118 6/26/2026
2.0.1 95 6/26/2026
2.0.0 101 6/25/2026