百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

Rocks

> 测试质量
开源

基于编译器 API (Roslyn + Mocks) 的模拟库

386 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

基于编译器 API (Roslyn + Mocks) 的模拟库

Rocks

A mocking library based on the Compiler APIs (Roslyn + Mocks).

Getting Started

Reference the Rocks NuGet package - that's it.

Prerequisites

The Rocks package targets .NET Standard 2.0 for host flexibility. That said, Rocks (as of 10.0.0) will generate code that requires .NET 10.

Usage

To make a mock, you take an interface or an unsealed class that has virtual members:

csharp
public interface IAmSimple
{
  void TargetAction();
}

and you use Rocks to create a mock with expectations, along with verifying its usage:

csharp
[assembly: Rock(typeof(IAmSimple), BuildType.Create)]

var expectations = new IAmSimpleCreateExpectations();
expectations.Setups.TargetAction();

var mock = expectations.Instance();
mock.TargetAction();

expectations.Verify();

More details can be found on the Overview page.

Additional Documentation

  • Discord Server
  • Changelog
  • Unit testing best practices with .NET Core and .NET Standard
  • BenchmarkMockNet
  • Unit Testing CSLA Rules With Rocks

Feedback

If you run into any issues, please add them here.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

C#csharpcsharp-sourcegeneratormockmocking

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类测试质量
定价开源

> 相关工具

J
Jest
JavaScript 测试框架
P
Playwright
现代端到端测试框架
E
eslint-plugin-test-selectors
Enforces that data-test-id attributes are added to interactive DOM elements (JSX) to help with UI testing. JSX only.