JasonBock / Rocks

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

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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. Note that Rocks looks for, and generates, code that targets .NET 7.

Usage

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

public interface IAmSimple
{
  void TargetAction();
}

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

var expectations = Rock.Create<IAmSimple>();
expectations.Methods().TargetAction();

var mock = 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)

License:MIT License


Languages

Language:C# 100.0%Language:Smalltalk 0.0%