Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
R

Rocks

> 测试质量
Open source

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

386 stars0 likes2 views
WebsiteGitHub

About

A mocking library based on the Compiler APIs (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 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C#csharpcsharp-sourcegeneratormockmocking

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category测试质量
PricingOpen source

> Related tools

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.