| Project | Purpose |
|---|---|
| SharpClaw.Code.UnitTests | Fast tests (tools, permissions, serialization, MCP/plugin units, …) |
| SharpClaw.Code.IntegrationTests | Runtime + provider flows with real composition |
| SharpClaw.Code.MockProvider | DeterministicMockModelProvider, AddDeterministicMockModelProvider, ParityMetadataKeys, ParityProviderScenario |
| SharpClaw.Code.ParityHarness | End-to-end scenarios over real AddSharpClawRuntime + mock LLM |
Run all tests:
dotnet test SharpClawCode.slnBuild the example hosts as part of normal validation:
dotnet build examples/WebApiAgent/WebApiAgent.csproj
dotnet build examples/MinimalConsoleAgent/MinimalConsoleAgent.csproj
dotnet build examples/WorkerServiceHost/WorkerServiceHost.csproj
dotnet build examples/McpToolAgent/McpToolAgent.csprojFilter examples:
dotnet test SharpClawCode.sln --filter "FullyQualifiedName~ParityScenarioTests"
dotnet test SharpClawCode.sln --filter "FullyQualifiedName~ToolRegistry"DeterministicMockModelProvider implements IModelProvider with provider name mock.
Scenarios are selected via request Metadata key parityScenario (ParityMetadataKeys.Scenario):
streaming_text— deterministic deltas →"Hello world"stream_failure— throws (turn fails; session may becomeFailed)stream_slow— delays (cancellation / timeout scenarios)
AddDeterministicMockModelProvider registers the provider + PostConfigure<ProviderCatalogOptions> so default / deterministic aliases point at the mock.
ParityTestHost.Create (tests/SharpClaw.Code.ParityHarness/ParityTestHost.cs):
- Empty
IConfiguration AddSharpClawRuntime(configuration)AddDeterministicMockModelProvider()- Optional
ParityFixturePluginToolasISharpClawTool - Optional
ReplaceWithScriptedApprovals(bool)— swapsIApprovalServicefor deterministic approve/deny
ParityScenarioTests cover Provider/runtime, IToolExecutor (read/write/grep/bash), permissions, plugin echo tool, MCP registry partial startup, recovery after timeout.
Stable scenario ids are listed in ParityScenarioIds (e.g. streaming_text, read_file_roundtrip, write_file_allowed, write_file_denied, grep_chunk_assembly, bash_stdout_roundtrip, permission_prompt_approved, permission_prompt_denied, plugin_tool_roundtrip, mcp_partial_startup, recovery_after_timeout).
Note: Many scenarios exercise IToolExecutor directly rather than going through the LLM agent loop (which matches current AgentFrameworkBridge behavior).
CI restores and builds the full solution, explicitly builds every example host project, and then runs dotnet test on the solution. Parity tests use temp directories under Path.GetTempPath() and avoid network.