dotnet-testing-autofixture-nsubstitute-integration
✓AutoFixture 与 NSubstitute 集成指南 - 实现自动模拟 (Auto-Mocking)。 内容 AutoNSubstituteDataAttribute、冻结机制、贪婪策略当前。 包含IMapper (AutoMapper/Mapster)等特殊相依性的客制化处理。 适用于复杂相依性注入测试、模拟验证与行为设定。
SKILL.md
本技能介紹如何整合 AutoFixture 與 NSubstitute,透過 AutoFixture.AutoNSubstitute 套件實現自動模擬(Auto-Mocking)功能。這種整合方式可以大幅簡化具有多個相依性的服務類別測試,讓開發者專注於測試邏輯本身,而非繁瑣的物件建立過程。
| AutoFixture.AutoNSubstitute | AutoFixture 與 NSubstitute 整合 | nuget.org | | AutoFixture.Xunit2 | xUnit 整合(AutoData 屬性) | nuget.org | | NSubstitute | 模擬框架 | nuget.org |
| 服務層測試 | 通常有多個相依性,自動模擬效益最大 | | 複雜相依圖 | AutoFixture 自動處理多層相依性 | | 參數化測試 | 結合固定值與自動產生資料 | | 需要大量測試資料 | 減少手動建立測試資料的工作 | | 快速迭代開發 | 建構函式變更時測試通常不需修改 |
AutoFixture 与 NSubstitute 集成指南 - 实现自动模拟 (Auto-Mocking)。 内容 AutoNSubstituteDataAttribute、冻结机制、贪婪策略当前。 包含IMapper (AutoMapper/Mapster)等特殊相依性的客制化处理。 适用于复杂相依性注入测试、模拟验证与行为设定。 来源:kevintsengtw/dotnet-testing-agent-skills。
可引用信息
为搜索与 AI 引用准备的稳定字段与命令。
- 安装命令
npx skills add https://github.com/kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-autofixture-nsubstitute-integration- 分类
- </>开发工具
- 认证
- ✓
- 收录时间
- 2026-02-01
- 更新时间
- 2026-02-18
快速解答
什么是 dotnet-testing-autofixture-nsubstitute-integration?
AutoFixture 与 NSubstitute 集成指南 - 实现自动模拟 (Auto-Mocking)。 内容 AutoNSubstituteDataAttribute、冻结机制、贪婪策略当前。 包含IMapper (AutoMapper/Mapster)等特殊相依性的客制化处理。 适用于复杂相依性注入测试、模拟验证与行为设定。 来源:kevintsengtw/dotnet-testing-agent-skills。
如何安装 dotnet-testing-autofixture-nsubstitute-integration?
打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/kevintsengtw/dotnet-testing-agent-skills --skill dotnet-testing-autofixture-nsubstitute-integration 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code 或 Cursor 中使用
这个 Skill 的源码在哪?
https://github.com/kevintsengtw/dotnet-testing-agent-skills
详情
- 分类
- </>开发工具
- 来源
- skills.sh
- 收录时间
- 2026-02-01