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.
npx skills add kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-autofixture-nsubstitute-integrationgit clone --depth 1 https://github.com/kevintsengtw/dotnet-testing-agent-skillsWrote 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.
[](https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-autofixture-nsubstitute-integration)<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-autofixture-nsubstitute-integration"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-autofixture-nsubstitute-integration/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.
<a href="https://agentmods.dev/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-autofixture-nsubstitute-integration"><img src="https://agentmods.dev/badge/skills/kevintsengtw/dotnet-testing-agent-skills/dotnet-testing-autofixture-nsubstitute-integration.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00217 | $0.03994 |
| Opus 5 | $0.00109 | $0.01997 |
| Sonnet 5 | $0.00043 | $0.00799 |
| Haiku 4.5 | $0.00022 | $0.00399 |
Grade A, and why
dotnet-testing-autofixture-nsubstitute-integration 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.
How it starts
The opening of the file, as written. The whole thing — 443 lines — stays where its author put it; the contents beside it link to each section on GitHub.
AutoFixture + NSubstitute 自動模擬整合
核心價值
- 減少樣板程式碼:不需要手動為每個介面建立
Substitute.For<T>() - 自動處理複雜相依圖:AutoFixture 會自動解析並建立所需的物件
- 提升測試維護性:當建構函式變更時,測試程式碼通常不需要同步修改
- 保持測試重點:讓開發者專注於測試邏輯而非物件建立
套件安裝與設定
必要套件
# 核心套件
dotnet add package AutoFixture.AutoNSubstitute
# 相關套件(如尚未安裝)
dotnet add package AutoFixture
dotnet add package AutoFixture.Xunit2
dotnet add package NSubstitute
dotnet add package xunit
NuGet 套件資訊
| 套件名稱 | 用途 | NuGet 連結 |
|---|---|---|
AutoFixture.AutoNSubstitute |
AutoFixture 與 NSubstitute 整合 | nuget.org |
AutoFixture.Xunit2 |
xUnit 整合(AutoData 屬性) | nuget.org |
NSubstitute |
模擬框架 | nuget.org |
核心概念
AutoNSubstituteCustomization 的作用
當在 AutoFixture 中加入 AutoNSubstituteCustomization 時,它會自動:
- 偵測介面類型:當 AutoFixture 遇到介面或抽象類別時
- 自動建立替身:使用 NSubstitute 的
Substitute.For<T>()建立 Mock 物件 - 注入相依性:將這些替身物件注入到需要的建構函式中
- 保持實例一致性:確保相同類型的替身在同一個測試中保持一致
using AutoFixture;
using AutoFixture.AutoNSubstitute;
// 建立包含 AutoNSubstitute 功能的 Fixture
var fixture = new Fixture().Customize(new AutoNSubstituteCustomization());
// 自動建立服務和其相依性
// MyService 的所有介面相依性都會自動變成 NSubstitute 的替身
var service = fixture.Create<MyService>();
FrozenAttribute 凍結機制
[Frozen] 屬性用來控制測試中某個類型的實例:
- 當參數被標註為
[Frozen]時,AutoFixture 會建立這個類別的一個實例並凍結它 - 後續在測試方法中都會使用同一個已凍結的實例
- 這對於需要設定相依性行為然後驗證 SUT 的測試特別重要
[Theory]
[AutoData]
public async Task TestMethod(
[Frozen] IRepository repository, // 這個 repository 會被凍結
MyService sut) // sut 會使用同一個 repository
{
// 設定凍結實例的行為
repository.GetAsync(Arg.Any<int>()).Returns(someData);
// SUT 內部使用的是同一個 repository 實例
var result = await sut.DoSomething();
}
What ships with it
5 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.
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.
- 10d ago First seen · 443 lines · 217 tokens per session scan A d0b2402a4b9f
dotnet-testing-autofixture-nsubstitute-integration is a skill published in the GitHub repository kevintsengtw/dotnet-testing-agent-skills (28 stars, last pushed 24d ago), licensed MIT. It adds 217 tokens to every session and 3,994 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.
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.
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…
csharp-xunit
Your goal is to help me write effective unit tests with XUnit, covering both standard and data-driven testing approaches.
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…
.NET Patterns
Use this skill when working in .NET projects (C#) and you want clean layering, safe async usage, and maintainable dependency injection patterns.
csharp-tunit
Get best practices for TUnit unit testing, including data-driven tests.