·
Last changedVersion:
This version passed the hardening gate. Hardening applied 12 targeted changes and preserved all other text. Classified findings before hardening: 0. Classified findings closed: 0. Classified findings remaining: 0. Unclassified scanner findings remaining: 0. Review findings closed: 13. Review findings remaining: 1.
None
None
Expand | File | Group | Subtype | Severity | Status |
|---|
No findings available
0 findings
Your goal is to help me write effective unit tests with NUnit, covering both standard and data-driven testing approaches.
[ProjectName].TestsCalculatorTests for Calculator)dotnet test for running tests, passing the specific [ProjectName].Tests project rather than the whole solutiondotnet test restores packages, runs build steps, and executes setup code with your privileges; run it only in trusted repositories or after reviewing project files, build property files, and setup code, preferably in an isolated environment that holds no secrets[TestFixture] attribute to test classes[Test] attribute for test methodsMethodName_Scenario_ExpectedBehavior[SetUp] and [TearDown] for per-test setup and teardown[OneTimeSetUp] and [OneTimeTearDown] for per-class setup and teardown[SetUpFixture] for assembly-level setup and teardown, keeping setup code limited to resources local to the tests[TestCase] for inline test data[TestCaseSource] for programmatically generated test data[Values] for simple parameter combinations[ValueSource] for property or method-based data sources[Random] for random numeric test values only with a fixed or logged seed so failures can be reproduced; otherwise prefer [Range] or [TestCase] to keep tests idempotent[Range] for sequential numeric test values[Combinatorial] or [Pairwise] for combining multiple parametersAssert.That with constraint model (preferred NUnit style)Is.EqualTo, Is.SameAs, Contains.ItemAssert.That with constraints for value, collection and string checks; this guidance targets current NUnit releasesAssert.AreEqual (classic style), CollectionAssert, and StringAssert moved to a separate legacy namespace in newer NUnit major versions and will not compile unless it is imported; use them only when maintaining older test codeAssert.Throws<T> or Assert.ThrowsAsync<T> to test exceptions[Category("CategoryName")][Order] only as a last resort when sequencing is unavoidable; unit tests must stay independent of execution order[Author("DeveloperName")] to indicate ownership[Description] to provide additional test information[Explicit] for tests that shouldn't run automatically; make sure explicit and ignored tests are reported in CI, and keep security tests in the regular run[Ignore("Reason")] to temporarily skip tests, giving a reason that references a tracking issue and an end dateGet started with chainctlchainctl skill install public/github/csharp-nunit:latest
Bring Chainguard's hardening pipeline to your first-party skills — custom rulesets, automated remediation, full audit trail.
skills.cgr.dev/public/github.com/github/skills/csharp-nunit:latest
MIT
HARDENING.md
LICENSE
SKILL.md