dotnet-testing-advanced-tunit-fundamentals

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

A guide to using TUnit, a testing framework for .NET applications. It covers creating tests, moving from xUnit, and running tests with compile-time discovery and ahead-of-time compilation.

In plain words
What is it for?
Use it to create a TUnit test project, write basic or parameterized tests, manage setup and cleanup, control parallel execution, or migrate xUnit tests.
Why use it?
It explains the setup and syntax differences that can make adopting TUnit or leaving xUnit confusing. It also covers test lifecycles, asynchronous checks, and controlling tests that run at the same time.

Skill for Claude CodeCodex

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

Good fit Use it to create a TUnit test project, write basic or parameterized tests, manage setup and cleanup, control parallel execution, or migrate xUnit tests.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-tunit-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-advanced-tunit-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-advanced-tunit-fundamentals

README.md
[![agentmods](https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-tunit-fundamentals/github.svg)](https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-tunit-fundamentals)
Your own site
<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-tunit-fundamentals"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-tunit-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-advanced-tunit-fundamentals

Your own site · 80×15
<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-tunit-fundamentals"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-advanced-tunit-fundamentals.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 226 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,244 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.00226 $0.02244
Opus 5 $0.00113 $0.01122
Sonnet 5 $0.00045 $0.00449
Haiku 4.5 $0.00023 $0.00224

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

Security

Grade A, and why

dotnet-testing-advanced-tunit-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-advanced-tunit-fundamentals/SKILL.md · 177 lines

How it starts

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

TUnit 新世代測試框架入門基礎

TUnit 框架核心特色

1. Source Generator 驅動的測試發現

TUnit 與傳統測試框架最大的差異在於使用 Source Generator 在編譯時期完成測試發現,避免反射成本、完全支援 Native AOT、更快的啟動時間。

// TUnit 在編譯時期就透過 Source Generator 產生測試註冊程式碼
public class ModernTests
{
    [Test] // 編譯時期就被處理和最佳化
    public async Task TestMethod()
    {
        await Assert.That(true).IsTrue();
    }
}

2. AOT (Ahead-of-Time) 編譯支援

傳統 JIT:C# 原始碼 → IL 中間碼 → 執行時期 JIT 編譯 → 機器碼 → 執行
AOT:    C# 原始碼 → 編譯時期直接產生 → 機器碼 → 直接執行

AOT 優勢:超快啟動時間、更小的記憶體占用、可預測的效能、更適合容器化部署。大型專案可達 10-30 倍啟動時間改善。

3. Microsoft.Testing.Platform 採用

TUnit 建構在微軟最新的 Microsoft.Testing.Platform 之上,而非傳統的 VSTest 平台。

重要注意事項: TUnit 專案不需要不應該安裝 Microsoft.NET.Test.Sdk 套件。

4. 預設並行執行

TUnit 將並行執行設為預設,需要時可用 [NotInParallel("GroupName")] 控制特定測試群組依序執行。

TUnit 專案建立

支援手動建立(console 模板 + TUnit 套件)或使用 TUnit Template(dotnet new tunit,推薦)。專案需設定 csproj(TUnit 套件、IsTestProject)與 GlobalUsings.cs。所有測試方法必須是非同步的async Task)。

完整專案建立步驟與 csproj 範例請參閱 references/project-setup.md

測試屬性與參數化

基本測試 [Test]

TUnit 統一使用 [Test] 屬性,不像 xUnit 區分 [Fact][Theory]

[Test]
public async Task Add_輸入1和2_應回傳3()
{
    var calculator = new Calculator();
    var result = calculator.Add(1, 2);
    await Assert.That(result).IsEqualTo(3);
}

參數化測試 [Arguments]

[Test]
[Arguments(1, 2, 3)]
[Arguments(-1, 1, 0)]
[Arguments(0, 0, 0)]
public async Task Add_多組輸入_應回傳正確結果(int a, int b, int expected)
{
    var calculator = new Calculator();
    var result = calculator.Add(a, b);
    await Assert.That(result).IsEqualTo(expected);
}

TUnit.Assertions 斷言系統

TUnit 採用流暢式(Fluent)斷言設計,所有斷言都是非同步的。支援相等性、布林值、數值比較、字串、集合、例外等多種斷言,並可透過 And / Or 組合條件。

await Assert.That(actual).IsEqualTo(expected);
await Assert.That(email).Contains("@").And.EndsWith(".com");
await Assert.That(() => action()).Throws<InvalidOperationException>();

完整斷言類型與範例請參閱 references/tunit-assertions-detail.md

Read the full file on GitHub · 177 lines

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 · 177 lines · 226 tokens per session scan A 99922c5c9862

Subscribe to this mod's changes

dotnet-testing-advanced-tunit-fundamentals is a skill published in the GitHub repository kevintsengtw/dotnet-testing-agent-skills (28 stars, last pushed 25d ago), licensed MIT. It adds 226 tokens to every session and 2,244 once invoked, about $0.0011 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