Skip to main content

Choose C# and .NET test layers with provider-real database tests, isolated fixtures, and async-safe assertions. Use for conventional C# test projects, xUnit/NUnit/MSTest, EF Core testing strategy, and integration-test data isolation; defer language, async, and build configuration.

  • New
  • v1.0.0
  • Reviewed Dec 4
  • No reviews yet

Getting started

Full instructions

Install the skill, then ask your AI tool for the task in plain words. The full SKILL.md below shows what it covers.

Instructions: SKILL.mdv1.0.0

C# Testing Strategy

Priority: P1 (HIGH)

Choose the Smallest Honest Layer

  • Unit: Pure domain logic, validation, and state machines. No DbContext, HTTP, clock, or filesystem.
  • Integration: EF Core mapping, transactions, provider-specific SQL, and serialization. Use the real provider or a provider-real test database.
  • End-to-end: Only when wiring across processes is the risk. Keep it few and deterministic.

EF Core and Databases

  • Do not mock DbContext: It proves nothing about mapping, SQL, or transactions.
  • Provider-real: SQLite in-memory is relational but not the production provider; use PostgreSQL/Testcontainers when provider behavior matters.
  • Isolation: Give each test or class a unique database or schema; clean with a transaction rollback or recreation in DisposeAsync.
  • Migrations: Test the migration path when a change is not representable by the current model.
  • See Testing strategy.

Test Project Rules

  • Layout: Keep tests in a separate *.Tests project referencing production; production never references tests.
  • Naming: Use Method_Scenario_ExpectedBehavior or the team's existing convention; one behavior per test.
  • Equivalent inputs: Use [Theory]/[InlineData] or parameterized tests instead of copy-paste cases.
  • Async: await the system under test; pass a CancellationToken; never use .Result.
  • No shared mutable statics: Use IClassFixture/IAsyncLifetime and fresh fixtures.
  • No network or clock dependencies: Inject TimeProvider or a clock seam; stub external HTTP at the boundary.

Assertions and Evidence

  • Assert observable outcomes and contracts, not internal call choreography.
  • Treat coverage as diagnostic; add a test only for a distinct plausible regression.
  • A green test that cannot fail for the stated risk is not evidence.

Anti-Patterns

  • No in-memory provider for relational behavior: It hides SQL and constraint differences.
  • No shared database across parallel tests.
  • No Thread.Sleep: Use deterministic waits or fake time.
  • No test-only branches in production code: Use seams and dependency injection.

References

  • Provider matrix, fixtures, and EF Core strategy

Explore more skills

Browse all
This skill doesn’t include stateful context yet, instructions only. Learn about stateful skills.

Security

Loading security scan...

Signing

Verified copySLSA L1
Signed by
skills-hub.ai verified copy of https://github.com/HoangNguyen0403/agent-skills-standard
Method
Verified copy of the source repoPublished by a community repo, not by skills-hub.ai. We signed this exact version to vouch that its content matches what the repo published. Check it with `npx @skills-hub-ai/cli verify`.
Key
skills-hub-ed25519-2026-11
Signed

Reviews (0)

More from Multi-Language Standards

View source →
typescript-best-practicesWrite idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic.32 installscavemanUltra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says…26 installsphp-securityPHP-only security standards for database access, password handling, and input validation. Use when securing PHP apps against SQL injection, XSS, or weak password storage; defer Laravel middleware and security questions in other languages.16 installscommon-security-auditProbe for hardcoded secrets, injection surfaces, unguarded routes, business logic flaws, and platform-specific weaknesses across backend (Node, Go, Java, Python, Rust), frontend (React, Angular, Vue), and mobile (iOS, Android, Flutter)…14 installsandroid-performanceOptimize Android app startup, UI rendering, frame stability, and benchmark performance with Baseline Profiles, Macrobenchmark, and lazy initialization. Use when reducing startup time, diagnosing jank, or measuring rendering; defer Compose…10 installsandroid-composeBuild high-performance declarative UI with Jetpack Compose. Use when writing Composable functions, optimizing recomposition, hoisting state, or working with LazyColumn and side effects; defer deep-link and navigation routing to…9 installs

Frequently asked questions about csharp-testing

What does the csharp-testing skill do?

Choose C# and .NET test layers with provider-real database tests, isolated fixtures, and async-safe assertions. Use for conventional C# test projects, xUnit/NUnit/MSTest, EF Core testing strategy, and integration-test data isolation; defer language, async, and build configuration. It's a reusable SKILL.md instruction set that loads into your AI coding assistant on demand, no prompt engineering, no copy-pasting every session.

How do I install the csharp-testing skill?

Run `npx @skills-hub-ai/cli install multi-language-standards-csharp-testing` from your terminal. The CLI writes the SKILL.md to the correct location for your AI tool (e.g. ~/.claude/skills/multi-language-standards-csharp-testing/ for Claude Code or ~/.cursor/skills/ for Cursor with --target cursor) and adds it to your project's .skills.json lockfile.

Which AI tools does csharp-testing work with?

csharp-testing runs in Claude Code. It follows the open Agent Skills standard (SKILL.md), so the same skill works in every supported tool without modification.

Is the csharp-testing skill free?

Yes. Every skill on skills-hub.ai is free and open-source. There are no premium tiers, paywalls, or usage limits. You only pay for whatever AI assistant you're already using.

How do I use csharp-testing after installing it?

In Claude Code, type `/multi-language-standards-csharp-testing` (or whatever slash command the skill registers) and the AI follows the skill's instructions immediately. You can also reference it by name in natural language, your AI loads the skill into context when relevant.

Can I share the csharp-testing skill with my team?

Yes. Commit your project's .skills.json lockfile and teammates run `npx @skills-hub-ai/cli install` (no args) to install every skill at the exact version you pinned. Organization-scoped installs work via skills-hub.ai organizations.

Badge for your README

Show that this skill is on Skills Hub. The badge links back to this page and shows the live install count.

Install on Skills Hub badge preview
Markdown
[![Install on Skills Hub](https://skills-hub.ai/api/badges/skill/multi-language-standards-csharp-testing)](https://skills-hub.ai/skills/multi-language-standards-csharp-testing)
HTML
<a href="https://skills-hub.ai/skills/multi-language-standards-csharp-testing"><img src="https://skills-hub.ai/api/badges/skill/multi-language-standards-csharp-testing" alt="Install on Skills Hub"></a>

More options in the badge docs.