qa-testing-nunit
C# Testing NUnit Fixtures
Quick Reference
- Classify test scope first: API, component, or integration.
- Lock runtime constraints before execution: Docker availability, framework target, and explicitly excluded suites.
- Use this skill for test-suite architecture and fixture behavior, not for general service implementation or CI graph refactors.
- Default to two files per handler/use case:
<Feature>Fixture.csand<Feature>Tests.cs. - For full-cycle API tests, use controller-focused structure: one fixture per controller/test family and one base
ApiTest.cs+ApiFixture.cs(split by scenario family only when needed). - Do not translate SpecFlow/Taffy step definitions into C# line-by-line; rewrite scenario intent into idiomatic API tests.
- For API migrations, avoid one global shared setup fixture; each controller/test family fixture owns its own dependencies.
- Fixture ownership for API tests should include DB launcher + migrators + WireMock + WebApplicationFactory + client.
- Reset mutable state in
[SetUp]; dispose all owned infra in[OneTimeTearDown]. - For DB bootstrapping, follow pricing-style
DatabaseLauncher + MigratorContainerfromtests/utils/Sc.Fin.Pricing.Tests.Utils/Testcontainers. - Use canonical migrator command
dotnet Sc.Tool.FluentMigrator.dll migrateup -m /sqland avoid custom ready-check arguments in tests. - Keep migrator ordering explicit (dependency migrators first, domain migrator last) and support fixture-level optional migrator toggles when some suites do not need all DBs.
- Add explicit migrator verification tests that assert launcher startup, migrator completion/order, and required tables.
- Use iterative quality loop:
code -> build -> run tests -> fix -> repeat. - For health endpoints, use
[Test] + [TestCase] + [CancelAfter(...)]with method signature(string url, CancellationToken cancellationToken); keep[Test]together with[TestCase]to avoid NUnit analyzer issues. - If user excludes infra-dependent suites (for example component tests requiring Docker), run feasible categories first and report exactly what remains unvalidated.
More from vasilyu1983/ai-agents-public
product-management
Founder-PM toolkit for discovery, roadmaps, prioritization, and PMF measurement. Use when planning product strategy, metrics, or roadmaps.
684software-architecture-design
Designs system structure across monolith/microservices/serverless. Use when structuring systems, scaling, decomposing monoliths, or choosing patterns.
519software-ui-ux-design
Designs and audits UI/UX with WCAG 2.2 accessibility. Use when designing flows, running heuristic reviews, or defining design systems.
383qa-testing-playwright
E2E web testing with Playwright. Use when writing tests, debugging flakes, or setting up CI with selectors, sharding, and network mocking.
372document-pdf
Extract text/tables from PDFs, create formatted PDFs, merge/split/rotate, and handle forms. Use for any PDF generation or parsing task.
325qa-testing-strategy
Risk-based test strategy for software delivery. Use when defining coverage, setting CI gates, managing flaky tests, or establishing release criteria.
317