SharpClaw.ModuleSDK.Testing
0.5.0-dev.20260925.3
dotnet add package SharpClaw.ModuleSDK.Testing --version 0.5.0-dev.20260925.3
NuGet\Install-Package SharpClaw.ModuleSDK.Testing -Version 0.5.0-dev.20260925.3
<PackageReference Include="SharpClaw.ModuleSDK.Testing" Version="0.5.0-dev.20260925.3" />
<PackageVersion Include="SharpClaw.ModuleSDK.Testing" Version="0.5.0-dev.20260925.3" />
<PackageReference Include="SharpClaw.ModuleSDK.Testing" />
paket add SharpClaw.ModuleSDK.Testing --version 0.5.0-dev.20260925.3
#r "nuget: SharpClaw.ModuleSDK.Testing, 0.5.0-dev.20260925.3"
#:package SharpClaw.ModuleSDK.Testing@0.5.0-dev.20260925.3
#addin nuget:?package=SharpClaw.ModuleSDK.Testing&version=0.5.0-dev.20260925.3&prerelease
#tool nuget:?package=SharpClaw.ModuleSDK.Testing&version=0.5.0-dev.20260925.3&prerelease
SharpClaw.ModuleSDK.Testing
SharpClaw.ModuleSDK.Testing compiles real package registrations and runs their behavior through the production SharpClaw.Core graph. It keeps scope validation, effect grants, sensitive approvals, outcome rules, cancellation, and handler disposal active.
Build a Test Host
Pass the real package.json path when package metadata is part of the test. The builder uses PackageManifestLoader and compiles the manifest host mode. The builder rejects an absent or unsupported hostMode.
await using var host = new SharpClawModuleTestBuilder()
.ConfigureServices(services => services.AddSingleton(testCapture))
.AddRegistration(new SampleAuthorizationModule(), manifestPath)
.ApproveSensitiveContributions("sample_authorization")
.UseExecutionContext(caller, features)
.Build();
Execution Methods
| Method | Use |
|---|---|
Action(...).WithTerminal(...) |
Test a package hook around a host-owned terminal. |
ActionEntry(...) |
Test the package-owned registered terminal. |
Event(...) |
Dispatch an event through the compiled Core graph. |
InvokeToolAsync(...) |
Invoke a tool with caller, feature, and conversation authority. |
InvokeCliAsync(...) |
Resolve and invoke one scoped CLI handler. |
InvokeHttpAsync(...) |
Resolve and invoke one scoped HTTP handler. |
InvokeWebSocketAsync(...) |
Resolve and invoke one scoped WebSocket handler. |
InScopeAsync(...) |
Resolve package services in a bounded asynchronous scope. |
StartAsync and StopAsync |
Test lifecycle behavior through Core lifecycle actions. |
ActionEntry requires one matching action definition and one matching terminal registration. Each application method also requires one exact contribution identity. The host resolves each handler in a new asynchronous scope. Scoped handlers do not become hidden singletons.
Call UseHostActionEntry when application behavior enters a host-owned action. The test host gives that instance priority over package service registrations. Without this call, host action entry requests fail closed.
Sensitive Behavior
Call ApproveSensitiveContributions only for each package identity that production explicitly approves. The test host creates exact schema-bound approvals. It does not disable sensitive checks or grant wildcard authority.
Authorization Example
The following call executes the registered authorization terminal and all approved restrictions. A restriction denial returns the declared failed outcome before the policy terminal runs.
var outcome = await host.ActionEntry(
AuthorizationProtocol.Evaluate,
new AuthorizationRequest(
"documents.read",
new AuthorizationResource("document", documentId)))
.RunAsync(cancellationToken);
This package is test-only. Production hosts do not reference it.
| 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. |
-
net10.0
- Microsoft.Extensions.DependencyInjection (>= 10.0.8)
- SharpClaw.Contracts (= 0.5.0-dev.20260920.1)
- SharpClaw.Core (= 0.5.0-dev.20260925.3)
- SharpClaw.ModuleSDK (= 0.5.0-dev.20260920.1)
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.5.0-dev.20260925.3 | 0 | 9/25/2026 |
| 0.5.0-dev.20260920.1 | 54 | 9/20/2026 |
| 0.5.0-dev.20260919.3 | 52 | 9/19/2026 |
| 0.5.0-beta.17 | 67 | 9/2/2026 |
| 0.5.0-beta.16 | 62 | 9/2/2026 |
| 0.5.0-beta.15 | 65 | 9/2/2026 |
| 0.5.0-beta.14 | 66 | 9/2/2026 |
| 0.5.0-beta.3 | 80 | 8/14/2026 |