Rocks 8.3.1

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package Rocks --version 8.3.1                
NuGet\Install-Package Rocks -Version 8.3.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rocks" Version="8.3.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rocks --version 8.3.1                
#r "nuget: Rocks, 8.3.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rocks as a Cake Addin
#addin nuget:?package=Rocks&version=8.3.1

// Install Rocks as a Cake Tool
#tool nuget:?package=Rocks&version=8.3.1                

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 8.

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:

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

var expectations = new IAmSimpleCreateExpectations();
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.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on Rocks:

Package Downloads
Stashbox.Rocks

Rocks auto mocking integration for Stashbox.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.0.0-alpha.1 34 10/22/2024
8.3.1 922 10/2/2024
8.3.1-alpha.1 55 9/29/2024
8.3.0 1,278 7/24/2024
8.2.0 281 7/17/2024
8.1.0 822 4/16/2024
8.0.0 591 1/22/2024
8.0.0-alpha.3 68 1/21/2024
8.0.0-alpha.2 71 1/14/2024
8.0.0-alpha.1 85 1/13/2024
7.3.0 654 11/26/2023
7.2.0 320 11/10/2023
7.1.4 351 10/7/2023
7.1.3 575 7/31/2023
7.1.2 176 7/26/2023
7.1.1 229 7/17/2023
7.1.0 341 7/3/2023
7.0.1 566 3/30/2023
7.0.0 880 11/20/2022
7.0.0-alpha.3 107 11/9/2022
7.0.0-alpha.2 111 10/10/2022
7.0.0-alpha.1 114 9/10/2022
6.4.5 1,027 6/29/2022
6.4.4 515 6/28/2022
6.4.3 593 5/23/2022
6.4.2 461 5/22/2022
6.4.1 813 4/15/2022
6.4.0 544 3/22/2022
6.3.0 6,443 11/24/2021
6.2.0 538 10/20/2021
6.0.0 584 4/12/2021
5.1.2 7,935 1/21/2021
5.1.1 486 1/21/2021
5.1.0 482 12/21/2020
5.0.0 492 12/10/2020
5.0.0-rc3 298 12/8/2020
5.0.0-rc2 313 12/2/2020
5.0.0-rc1 413 11/14/2020
4.2.1 692 7/25/2020
4.2.0 547 7/2/2020
4.1.1 612 4/27/2020
4.1.0 637 2/26/2020
4.0.0 1,057 9/23/2019
4.0.0-rc.2 310 8/10/2019
4.0.0-rc.1 300 7/18/2019
3.1.0 5,240 11/4/2017
3.0.0 2,621 8/18/2017
2.2.0 2,603 7/6/2017
2.1.7 2,592 7/4/2017
2.1.6 2,635 7/4/2017
2.1.5 2,596 7/4/2017
2.1.4 2,578 7/2/2017
2.1.3 2,590 7/2/2017
2.1.2 2,532 7/1/2017
2.1.1 2,608 7/1/2017
2.1.0 3,248 5/19/2017
2.0.0 3,539 5/1/2017
2.0.0-beta 2,289 4/30/2017
1.1.1 2,605 5/4/2016
1.0.0 2,580 1/29/2016
1.0.0-beta1 2,702 8/8/2015