スキル一覧に戻る
michaellperry

unit-testing

by michaellperry

0🍴 0📅 2026年1月23日
GitHubで見るManusで実行

SKILL.md


name: unit-testing description: Provides unit testing patterns for .NET applications using EF Core In-Memory Provider, AAA structure, test data helpers, and TDD workflows. Use when writing unit tests for services, repositories, or domain logic.

Unit Testing Patterns for .NET

Unit testing patterns for .NET applications covering test structure, EF Core in-memory database setup, test data helpers, and TDD workflows.

TDD Philosophy

TDD is about unit tests only. Unit tests drive implementation using EF Core In-Memory Provider for fast, isolated testing.

Integration tests follow implementation. They use real databases to verify migrations, complex queries, and system integration.

Test Structure

  • AAA Pattern: Arrange-Act-Assert with Given-When-Then comments
  • Test Naming: MethodName_Scenario_ExpectedBehavior
  • Given-When-Then Comments: Describe test flow and intent

EF Core In-Memory Database Setup

Load the resource when configuring DbContext for unit tests, setting up ITenantContext, ensuring per-test database isolation, and understanding provider limitations. See patterns/ef-core-in-memory-setup.md.

Multi-Tenancy Testing

Use the in-memory setup resource for guidance on tenant filtering, admin/null-tenant behavior, and navigation property filter limitations. Load patterns/ef-core-in-memory-setup.md when multi-tenancy affects your tests.

Test Data Helper Patterns

Load the resource when authoring Given helpers: require parent navigation properties for child entities, use sensible defaults for scalars, and avoid foreign keys. See patterns/test-data-helpers.md.

Mocking Strategy

  • Use EF Core In-Memory for data operations; avoid mocking data access.
  • Mock external dependencies only (email, payment gateways, APIs).

Best Practices

  1. Use AAA Pattern with Given-When-Then comments
  2. Follow MethodName_Scenario_ExpectedBehavior naming
  3. Initialize navigation properties, never foreign keys
  4. Make parent entities required parameters in Given methods
  5. Use in-memory database for repository/service tests
  6. Mock external dependencies only
  7. Focus unit tests on business logic
  8. Use integration tests for navigation property tenant isolation

Resources

スコア

総合スコア

50/100

リポジトリの品質指標に基づく評価

SKILL.md

SKILL.mdファイルが含まれている

+20
LICENSE

ライセンスが設定されている

0/10
説明文

100文字以上の説明がある

0/10
人気

GitHub Stars 100以上

0/15
最近の活動

3ヶ月以内に更新がある

0/10
フォーク

10回以上フォークされている

0/5
Issue管理

オープンIssueが50未満

+5
言語

プログラミング言語が設定されている

+5
タグ

1つ以上のタグが設定されている

0/5

レビュー

💬

レビュー機能は近日公開予定です