dotnet-testing-unit-test-fundamentals

dotnet-testing-unit-test-fundamentals is a skill for Claude Code, Codex from kevintsengtw/dotnet-testing-agent-skills. It costs 193 tokens per session (2,664 once invoked), scanned A, original, MIT.

A beginner’s guide to unit testing in .NET, where small automated checks verify individual parts of a program. It covers the FIRST principles and the arrange-act-assert test structure.

In plain words
What is it for?
It is for learning how to write and structure basic .NET unit tests, including xUnit facts and theories, test isolation, clear checks, and the test pyramid.
Why use it?
New tests can be slow, dependent on one another, difficult to repeat, or unclear when they fail. The guide explains practices that make basic tests reliable and understandable.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit It is for learning how to write and structure basic .NET unit tests, including xUnit facts and theories, test isolation, clear checks, and the test pyramid.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-unit-test-fundamentals
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-unit-test-fundamentals
Clone the repo
git clone --depth 1 https://github.com/kevintsengtw/dotnet-testing-agent-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for dotnet-testing-unit-test-fundamentals

README.md
[![agentmods](https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-unit-test-fundamentals/github.svg)](https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-unit-test-fundamentals)
Your own site
<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-unit-test-fundamentals"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-unit-test-fundamentals/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for dotnet-testing-unit-test-fundamentals

Your own site · 80×15
<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-unit-test-fundamentals"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-unit-test-fundamentals.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 193 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,664 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00193 $0.02664
Opus 5 $0.00097 $0.01332
Sonnet 5 $0.00039 $0.00533
Haiku 4.5 $0.00019 $0.00266

Measured 10d ago against content hash 52e52ee421ee, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

dotnet-testing-unit-test-fundamentals scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/dotnet-testing-unit-test-fundamentals/SKILL.md · 301 lines

How it starts

The opening of the file, as written. The whole thing — 301 lines — stays where its author put it; the contents beside it link to each section on GitHub.

.NET 單元測試基礎指南

FIRST 原則

好的單元測試遵循以下原則,因為這些原則能確保測試的可靠性與維護性:

F - Fast (快速)

測試執行時間應在毫秒級,不依賴外部資源。

[Fact] // Fast: 不依賴外部資源,執行快速
public void Add_輸入1和2_應回傳3()
{
    // 純記憶體運算,無 I/O 或網路延遲
    var calculator = new Calculator();
    var result = calculator.Add(1, 2);
    Assert.Equal(3, result);
}

I - Independent (獨立)

測試之間不應有相依性,每個測試都建立新的實例。

[Fact] // Independent: 每個測試都建立新的實例
public void Increment_從0開始_應回傳1()
{
    var counter = new Counter(); // 每個測試都建立新的實例,不受其他測試影響
    counter.Increment();
    Assert.Equal(1, counter.Value);
}

R - Repeatable (可重複)

在任何環境都能得到相同結果,不依賴外部狀態。

[Fact] // Repeatable: 每次執行都得到相同結果
public void Increment_多次執行_應產生一致結果()
{
    var counter = new Counter();
    counter.Increment();
    counter.Increment();
    counter.Increment();
    
    // 每次執行這個測試都會得到相同結果
    Assert.Equal(3, counter.Value);
}

S - Self-Validating (自我驗證)

測試結果應為明確的通過或失敗,使用清晰的斷言。

[Fact] // Self-Validating: 明確的驗證
public void IsValidEmail_輸入有效Email_應回傳True()
{
    var emailHelper = new EmailHelper();
    var result = emailHelper.IsValidEmail("[email protected]");
    
    Assert.True(result); // 明確的通過或失敗
}

T - Timely (及時)

測試應在產品程式碼之前或同時撰寫,確保程式碼的可測試性。

3A Pattern 結構

每個測試方法遵循 Arrange-Act-Assert 模式,這種結構讓測試意圖一目了然:

[Fact]
public void Add_輸入負數和正數_應回傳正確結果()
{
    // Arrange - 準備測試資料與相依物件
    var calculator = new Calculator();
    const int a = -5;
    const int b = 3;
    const int expected = -2;

    // Act - 執行被測試的方法
    var result = calculator.Add(a, b);

    // Assert - 驗證結果是否符合預期
    Assert.Equal(expected, result);
}

各區塊職責

區塊 職責 注意事項
Arrange 準備測試所需的物件、資料、Mock 使用 const 宣告常數值,提高可讀性
Act 執行被測試的方法 通常只有一行,呼叫被測方法
Assert 驗證結果 每個測試只驗證一個行為

Read the full file on GitHub · 301 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 10d ago First seen · 301 lines · 193 tokens per session scan A 52e52ee421ee

Subscribe to this mod's changes

dotnet-testing-unit-test-fundamentals is a skill published in the GitHub repository kevintsengtw/dotnet-testing-agent-skills (28 stars, last pushed 24d ago), licensed MIT. It adds 193 tokens to every session and 2,664 once invoked, about $0.0010 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

author-test

Generate a test given sample. Parameters: C# SDK repository root; Package name: one of Azure.AI.Projects, Azure.AI.Projects.Agents or Azure.AI.Extensions.OpenAI; the sample to use as a starting point for the test.

Azure/azure-sdk-for-net · 68 tokens

migrate-xunit-to-xunit-v3

Migrate .NET test projects from xUnit.net v2 to xunit.v3 and fix v3 breaks. Use for package/CPM conversion, OutputType=Exe, preserving the VSTest or MTP runner (including projects currently using YTest.MTP.XUnit2), incompatible TFMs, async void tests, string-to-Type attributes, custom Fact/Theory/BeforeAfterTest…

managedcode/dotnet-skills · 149 tokens

csharp-xunit

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

PracticalSwan/agent-skills · 25 tokens

cratis-specs-csharp

Step-by-step guidance for writing C# specs in Cratis with BDD Specification by Example — the Establish/Because/should pattern, for/when/and folder hierarchy, reusable given/ contexts, NSubstitute mocking, and the in-process scenario family. Use when writing C# unit or integration specs or structuring the for/when/and…

Cratis/AI · 101 tokens

.NET Patterns

Use this skill when working in .NET projects (C#) and you want clean layering, safe async usage, and maintainable dependency injection patterns.

AmariahAK/atlarix-skills · 2 tokens

csharp-tunit

Get best practices for TUnit unit testing, including data-driven tests.

MarieLynneBlock/arcanum-artifex · 18 tokens