·moq
</>

moq

stuartf303/sorcha

使用 Moq 框架模拟单元测试中的依赖关系。 使用场合:编写单元测试、为接口创建测试替身、验证方法调用、模拟异步操作

6安装·2热度·@stuartf303

安装

$npx skills add https://github.com/stuartf303/sorcha --skill moq

SKILL.md

Moq provides type-safe mocking for .NET unit tests. Sorcha uses Moq extensively across 30+ test projects to isolate components and verify interactions. The codebase favors constructor injection with mocks stored as private readonly fields.

| Mock | Create mock instance | new Mock () | | .Object | Get mock instance | mock.Object | | Mock.Of () | Quick mock for simple deps | Mock.Of >() | | Setup() | Configure behavior | .Setup(x => x.Method()) | | ReturnsAsync() | Async return value | .ReturnsAsync(result) | | Callback() | Capture arguments | .Callback ((arg) => captured = arg) |

| Verify() | Assert method called | .Verify(x => x.Method(), Times.Once) | | It.IsAny () | Match any argument | It.IsAny () | | It.Is () | Match with predicate | It.Is (x => x.Id == 1) |

查看原文

可引用信息

为搜索与 AI 引用准备的稳定字段与命令。

安装命令
npx skills add https://github.com/stuartf303/sorcha --skill moq
分类
</>开发工具
认证
收录时间
2026-02-01
更新时间
2026-02-18

快速解答

什么是 moq?

使用 Moq 框架模拟单元测试中的依赖关系。 使用场合:编写单元测试、为接口创建测试替身、验证方法调用、模拟异步操作 来源:stuartf303/sorcha。

如何安装 moq?

打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/stuartf303/sorcha --skill moq 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code 或 Cursor 中使用

这个 Skill 的源码在哪?

https://github.com/stuartf303/sorcha

详情

分类
</>开发工具
来源
skills.sh
收录时间
2026-02-01