csharp-nunit

작성자: github

NUnit 모범 사례: .NET 프로젝트에서 표준 및 데이터 기반 단위 테스트를 수행합니다. [TestFixture] 클래스를 사용하여 프로덕션 코드와 일치하도록 테스트를 구성하고, MethodName_Scenario_ExpectedBehavior 형식의 [Test] 메서드와 Arrange-Act-Assert 구조를 따릅니다. [TestCase], [TestCaseSource], [Values], [Range], [Combinatorial] 특성을 통해 인라인, 프로그래매틱 및 매개변수화된 테스트 생성을 위한 데이터 기반 테스트를 수행합니다. Assert.That와 제약 조건 모델(Is.EqualTo, Contains.Item)을 사용합니다...

npx skills add https://github.com/github/awesome-copilot --skill csharp-nunit

NUnit Best Practices

Your goal is to help me write effective unit tests with NUnit, covering both standard and data-driven testing approaches.

Project Setup

  • Use a separate test project with naming convention [ProjectName].Tests
  • Reference Microsoft.NET.Test.Sdk, NUnit, and NUnit3TestAdapter packages
  • Create test classes that match the classes being tested (e.g., CalculatorTests for Calculator)
  • Use .NET SDK test commands: dotnet test for running tests

Test Structure

  • Apply [TestFixture] attribute to test classes
  • Use [Test] attribute for test methods
  • Follow the Arrange-Act-Assert (AAA) pattern
  • Name tests using the pattern MethodName_Scenario_ExpectedBehavior
  • Use [SetUp] and [TearDown] for per-test setup and teardown
  • Use [OneTimeSetUp] and [OneTimeTearDown] for per-class setup and teardown
  • Use [SetUpFixture] for assembly-level setup and teardown

Standard Tests

  • Keep tests focused on a single behavior
  • Avoid testing multiple behaviors in one test method
  • Use clear assertions that express intent
  • Include only the assertions needed to verify the test case
  • Make tests independent and idempotent (can run in any order)
  • Avoid test interdependencies

Data-Driven Tests

  • Use [TestCase] for inline test data
  • Use [TestCaseSource] for programmatically generated test data
  • Use [Values] for simple parameter combinations
  • Use [ValueSource] for property or method-based data sources
  • Use [Random] for random numeric test values
  • Use [Range] for sequential numeric test values
  • Use [Combinatorial] or [Pairwise] for combining multiple parameters

Assertions

  • Use Assert.That with constraint model (preferred NUnit style)
  • Use constraints like Is.EqualTo, Is.SameAs, Contains.Item
  • Use Assert.AreEqual for simple value equality (classic style)
  • Use CollectionAssert for collection comparisons
  • Use StringAssert for string-specific assertions
  • Use Assert.Throws<T> or Assert.ThrowsAsync<T> to test exceptions
  • Use descriptive messages in assertions for clarity on failure

Mocking and Isolation

  • Consider using Moq or NSubstitute alongside NUnit
  • Mock dependencies to isolate units under test
  • Use interfaces to facilitate mocking
  • Consider using a DI container for complex test setups

Test Organization

  • Group tests by feature or component
  • Use categories with [Category("CategoryName")]
  • Use [Order] to control test execution order when necessary
  • Use [Author("DeveloperName")] to indicate ownership
  • Use [Description] to provide additional test information
  • Consider [Explicit] for tests that shouldn't run automatically
  • Use [Ignore("Reason")] to temporarily skip tests

github의 다른 스킬

console-rendering
github
Go에서 struct 태그 기반 콘솔 렌더링 시스템 사용 지침
official
acquire-codebase-knowledge
github
사용자가 기존 코드베이스에 대한 매핑, 문서화, 또는 온보딩을 명시적으로 요청할 때 이 스킬을 사용하세요. "이 코드베이스를 매핑해줘", "문서화해줘"와 같은 프롬프트에서 트리거됩니다.
official
acreadiness-assess
github
현재 리포
official
acreadiness-generate-instructions
github
AgentRC 명령어를 통해 맞춤형 AI 에이전트 지침 파일을 생성합니다. .github/copilot-instructions.md 파일을 생성합니다(기본값, VS Code의 Copilot에 권장됨).
official
acreadiness-policy
github
사용자가 AgentRC 정책을 선택, 작성 또는 적용할 수 있도록 지원합니다. 정책은 관련 없는 검사를 비활성화하고, 영향/수준을 재정의하며, 설정을 통해 준비 상태 점수를 사용자 지정합니다.
official
add-educational-comments
github
코드 파일에 교육용 주석을 추가하여 효과적인 학습 자료로 변환합니다. 설명의 깊이와 어조를 세 가지 설정 가능한 지식 수준(초급, 중급, 고급)에 맞게 조정합니다. 파일이 제공되지 않으면 자동으로 요청하며, 빠른 선택을 위해 번호 목록 매칭을 제공합니다. 교육용 주석만을 사용하여 파일을 최대 125%까지 확장합니다(엄격한 제한: 새 줄 400개, 1,000줄 초과 파일의 경우 300개). 파일 인코딩, 들여쓰기 스타일, 구문 정확성 등을 유지합니다.
official
adobe-illustrator-scripting
github
Adobe Illustrator 자동화 스크립트를 ExtendScript(JavaScript/JSX)로 작성, 디버깅 및 최적화합니다. 스크립트를 생성하거나 수정하여 조작할 때 사용합니다.
official
agent-governance
github
선언적 정책, 의도 분류, AI 에이전트 도구 접근 및 행동 제어를 위한 감사 추적. 구성 가능한 거버넌스 정책은 허용/차단된 도구, 콘텐츠 필터, 속도 제한, 승인 요구 사항을 정의하며, 코드가 아닌 구성으로 저장됨. 의미론적 의도 분류는 패턴 기반 신호를 사용하여 도구 실행 전에 위험한 프롬프트(데이터 유출, 권한 상승, 프롬프트 인젝션)를 탐지함. 도구 수준 거버넌스 데코레이터는 함수에서 정책을 적용함...
official