Skip to content

Repository files navigation

Rocks

NuGet

Bugs

Issues

Rocks logo

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

Getting Started

Reference the RocksNuGet 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:

publicinterfaceIAmSimple{voidTargetAction();}

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

[assembly:Rock(typeof(IAmSimple),BuildType.Create)]varexpectations=newIAmSimpleCreateExpectations();expectations.Setups.TargetAction();varmock=expectations.Instance();mock.TargetAction();expectations.Verify();

More details can be found on the Overview page.

Additional Documentation

Feedback

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

About

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

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

389 stars

Watchers

12 watching

Forks

Releases

Packages

Used by

Contributors

Languages