monica-unit-testing
Create, migrate, or review Monica framework tests and shared testing infrastructure, including host-owned scenarios, raw ProjectUnit fixtures, Roslyn…
Skill by Tairitsua
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/tairitsua-monica-unit-testing
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: testing, devops
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/monica-unit-testing
What's inside
- Skill name
monica-unit-testing- Description
- Create, migrate, or review Monica framework tests and shared testing infrastructure, including host-owned scenarios, raw ProjectUnit fixtures, Roslyn source-generator tests, result assertions, and isolation.
- License
- MIT
- Instructions
- 104 lines in SKILL.md · view on GitHub
Files (4)
- SKILL.md
- openai.yaml · agents/
- samples.md · references/
- standards.md · references/
SKILL.md (first lines)
# Monica Unit Testing
Use `Monica.Testing` as the shared toolkit and keep runnable framework tests under `tests/Test.Monica.*`. Choose the smallest test boundary that proves the behavior without misrepresenting Monica's activation or host lifecycle.
## Workflow
1. Read `<project-root>/tests/README.md` for the current project layout and execution rules.
2. Classify the test before choosing infrastructure:
- Pure logic: construct the value or service directly.
- Raw ProjectUnit collaboration: use `ProjectUnitFixture<TUnit>` and accept its activation limits.
- Module wiring, options, conventional registration, proxies, hosted lifecycle, or cross-scope behavior: create a full host with `MonicaTestApplicationFactory<TDiscoveryAnchor>`.
- Blazor behavior contract: use bUnit in the runnable UI test project only when the user explicitly requests UI testing or UI test additions.
- Roslyn source-generator semantics: build an in-memory `CSharpCompilation` and run the generator through `GeneratorDriver`.
3. Put reusable assertions, host helpers, and deterministic boundary doubles in `Monica.Testing`; keep scenario-specific data and doubles in the runnable test project.
4. Prefer public-surface coverage: module registrations, facades, public models and abstractions, stable providers, and observable side effects.
5. Use the repository test runner or the relevant test project. Keep processes that share build outputs sequential.
## Host-Owned Scenarios
Use `MonicaTestApplicationFactory<TDiscoveryAnchor>` when the test depends on real Monica composition.
- Derive a project factory and implement `ConfigureMonica(IMonicaBuilder)` with the production module graph needed by the scenario.
- Use `ConfigureHost(WebApplicationBuilder)` for host configuration and environment inputs.
- Use `ConfigureServices(IServiceCollection)` for stable test-boundary registrations shared by every scenario produced by that factory. Call the base implementation first unless the scenario intentionally replaces all standard seams.
- Call `CreateAsync(...)` for each test scenario. Every call builds and starts a complete host with its own `MonicaApplication`, module graph, singleton services, logger ownership, and disposal boundary.
- Pass scenario-specific seam replacements to `CreateAsync(Action<ISeamReplacementBuilder>?)`. The callback changes registrations before the host is built.
- Call `MonicaTestApplication.CreateScope(...)` only to create a normal child scope. A built service provider is immutable; scope creation never replaces registrations.
- Dispose the `MonicaTestApplication` after the scenario, even when several scopes are used within that scenario.
Do not copy service descriptors into another root provider, share one `MonicaApplication` across providers, or emulate per-scope registration replacement.
## Persistence Scenarios
Keep production context/provider registration. UseTestDatabase overrides options and keeps one database per scenario/context type, with fresh scoped connections. Arrange with application.SeedAsync<TContext,TResult> and an explicit save; act through application.ExecuteAsync and the real IExecutionPipeline; verify in application.VerifyAsync<TContext>. Do not add synthetic save loops or clear trackers to repair tests.
Default seams retain real audit policy; replace TimeProvider/current-user/ID inputs. SeedAsync suppresses entity projections. Test `[Outbox]` publishing through the real scoped EventBus gateway, inspect committed row snapshots separately from delivery, and explicitly call DrainOutboxAsync<TContext>. Replace `IEventTransport`, not `IDistributedEventBus`, for provider recording. Include rollback after an early flush, failed results, generated-key capture, immutable payloads, retry identity, Inbox consumer uniqueness, and fresh-scope retries.
When a handler host has multiple write contexts, put `[ExecutionTransaction(ExecutionTransactionMode.Automatic, DbContextTypes = new[] { typeof(PrimaryDbContext), typeof(ParticipantDbContext) })]` on its concrete execution method and test the real receive pipeline. The selected primary context owns Inbox and Outbox rows; verify its final flush after later participants stage projections. Follow the persistence [transaction contract](../monica-infra-persistence/references/transactions.md) for selection and explicit execution features.
## Raw ProjectUnit Fast Path
`ProjectUnitFixture<TUnit>` is an explicitly raw fast-path harness. It creates a small Microsoft DI container, activates the target, and initializes Monica's cached-service-provider accessor where applicable.
Use it only when all collaborators are deliberately supplied and the assertion does not depend on:
- Monica module composition or options binding
- conventional type discovery and registration
- dynamic proxies or interceptors
- hosted-service startup and shutdown
- host-owned singleton or logging isolation
Use the host-owned scenario model for any of those behaviors. Do not introduce another application-service-specific fixture; `ApplicationServiceFixture<THandler>` is not part of the testing model.
## Roslyn Generator Boundary
Test source generators with raw Roslyn inputs under a dedicated `tests/Test.Monica.{GeneratorProject}` project.
- Reference the generator as a normal test dependency so the test can instantiate its public `IIncrementalGenerator` types. Do not rely on MSBuild analyzer execution for semantic generator tests.
- Create all source text in memory, provide explicit metadata references, and run `CSharpGeneratorDriver` with the same language version the scenario requires.
- Assert generator diagnostics, generated hint names and source, and the diagnostics of the updated output compilation.
- Run the same driver again with identical inputs and assert byte-identical generated sources and diagnostics. This protects incremental determinism.
- Verify generator execution does not create or mutate files. File export, package imports, and MSBuild target ordering belong in separate integration tests only when those build surfaces are intentionally under test.
- For request-owned Web API generation, cover the public contract matrix: route, verb, binding, operation naming, cancellation, result shapes, published-RPC namespace selection, local-only HTTP exclusion, duplicate or invalid declarations, and same-compilation client/controller availability.
- When a published request uses a custom `IRemoteResultEnvelope<TSelf>`, test that `CreateRemoteFailure` returns a valid constructor-initialized envelope and that cancellation is propagated rather than projected as a failure result.
## Required Conventions
- Shared toolkit: `Monica.Testing/Monica.Testing.csproj`
- Runnable project: `tests/Test.Monica.{ProjectName}/`
- Test class: `{TypeName}Tests`
- Test method: `Method_WhenCondition_ShouldExpectation`
- Test folders mirror source folders such as `Modules/`, `Facades/`, `Providers/`, `Services/`, `Pages/`, and `Components/`.
## Monica-Specific Rules
- Assert `Res<T>` explicitly. Facade tests cover `Status`, `Message`, and `Data`; successful `Res<string>` paths always verify `Data`.
- Test module behavior through registration extensions, dependencies, resulting options, or DI-visible registrations rather than static tables alone.
- Replace external boundaries, not domain logic. Resolve application services, domain services, repositories, mappers, and options from the scenario host.
- Avoid real network, uncontrolled persistence, sleeps, random inputs, and untracked machine state.
- Keep `InternalsVisibleTo` exceptional and scoped to the corresponding runnable test project.
- Run independent test scenarios in parallel by default. Serialize only tests that name and document a genuinely shared external resource.
## Default Stack
- xUnit v3
- AwesomeAssertions
- NSubstitute with its analyzer
- coverlet.collector
- bUnit in UI test projects only
- Microsoft.CodeAnalysis.CSharp in source-generator test projects only
## References
- Read `references/standards.md` for stable boundary and isolation rules.
- Read `references/samples.md` when selecting an existing framework sample.
- Use `$monica-application-unit-testing` for Monica-based business-service tests.
## Validation
- Match path syntax to the SDK process actually running.
- Keep build/test processes sharing outputs sequential.
- Run the relevant runnable test project and the repository's default non-UI gate when required. UI projects run only on explicit user request.From Tairitsua/Monica, MIT.
More from Tairitsua/Monica
- 0.639score
monica-application
Tairitsua
Apply the shared Monica application specification and the repository's project specification before designing, implementing, refactoring, or reviewing a…
SkillAFreshness: A★ 14Claude Code +9 - 0.639score
monica-guide
Tairitsua
Explain, bootstrap, configure, diagnose, update, and route the Monica toolbox, including application specification loading, extension/framework work, skill…
SkillAFreshness: A★ 14Claude Code +9 - 0.639score
monica-application-project-unit-development
Tairitsua
Apply Monica application unit rules when implementing, refactoring, or reviewing handlers, entities, repositories, events, jobs, seeders, host services, CRUD…
SkillAFreshness: A★ 14Claude Code +9 - 0.639score
monica-infra-ui
Tairitsua
Register and use Monica Blazor UI modules, the shell, icons, Markdown viewer, themes, navigation, and localization in a host.
SkillAFreshness: A★ 14Claude Code +9 - 0.639score
monica-application-unit-testing
Tairitsua
Apply Monica application testing rules when creating, refactoring, or reviewing behavior tests, host scenarios, persistence isolation, and provider seams.
SkillAFreshness: A★ 14Claude Code +9 - 0.637score
monica-infra-messaging
Tairitsua
Use when integrating Monica EventBus, RPC clients, DataChannel pipelines, or SignalR hubs and diagnosing their transport, delivery, and provider configuration.
SkillAFreshness: A★ 14Claude Code +9 - 0.637score
monica-infra-jobs
Tairitsua
Use when adding Monica JobScheduler recurring or triggered jobs, choosing its store and scope, or configuring startup seeders and their readiness behavior.
SkillAFreshness: A★ 14Claude Code +9 - 0.637score
monica-infra-configuration
Tairitsua
Use when integrating Monica managed configuration, bootstrap input plans, file or EF Core stores, pure object validation, observed options diagnostics…
SkillAFreshness: A★ 14Claude Code +9 - 0.637score
monica-infra-ai
Tairitsua
Configure and use Monica AI providers, chat, knowledge bases, RAG, runtime skills, and MCP in an application.
SkillAFreshness: A★ 14Claude Code +9 - 0.637score
monica-infra-persistence
Tairitsua
Use when integrating Monica Repository, UnitOfWork, transactional domain events, outbox, or inbox in an application, diagnosing save and commit behavior, or…
SkillAFreshness: A★ 14Claude Code +9 - 0.635score
monica-ui-development
Tairitsua
Implement Monica Blazor and MudBlazor v9 components, pages, themes, CSS isolation, local assets, browser storage, and async component lifecycle.
SkillAFreshness: A★ 14Claude Code +9 - 0.634score
monica-docs-authoring
Tairitsua
Write or revise Monica framework and module guidance, including localized Monica.Docs pages.
SkillAFreshness: A★ 14Claude Code +9
Signals
- Stars
- 14
- Forks
- 7
- Open issues
- 0
- Last commit (this folder)
- Oct 8, 2026 (21 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- Repository
- github.com/Tairitsua/Monica
- Website
- monica.dpdns.org/
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from Tairitsua
- 0.639score
monica-guide
Tairitsua
Explain, bootstrap, configure, diagnose, update, and route the Monica toolbox, including application specification loading, extension/framework work, skill…
SkillAFreshness: A★ 14Claude Code +9 - 0.639score
monica-infra-ui
Tairitsua
Register and use Monica Blazor UI modules, the shell, icons, Markdown viewer, themes, navigation, and localization in a host.
SkillAFreshness: A★ 14Claude Code +9 - 0.639score
monica-application
Tairitsua
Apply the shared Monica application specification and the repository's project specification before designing, implementing, refactoring, or reviewing a…
SkillAFreshness: A★ 14Claude Code +9 - 0.639score
monica-application-project-unit-development
Tairitsua
Apply Monica application unit rules when implementing, refactoring, or reviewing handlers, entities, repositories, events, jobs, seeders, host services, CRUD…
SkillAFreshness: A★ 14Claude Code +9 - 0.639score
monica-application-unit-testing
Tairitsua
Apply Monica application testing rules when creating, refactoring, or reviewing behavior tests, host scenarios, persistence isolation, and provider seams.
SkillAFreshness: A★ 14Claude Code +9 - 0.637score
monica-infra-ai
Tairitsua
Configure and use Monica AI providers, chat, knowledge bases, RAG, runtime skills, and MCP in an application.
SkillAFreshness: A★ 14Claude Code +9
Cite this page
monica-unit-testing skill. Agent Mart. https://agentmart.dev/skills/tairitsua-monica-unit-testing (last updated 2026-10-24)