RockHopper 1.0.1
dotnet add package RockHopper --version 1.0.1
NuGet\Install-Package RockHopper -Version 1.0.1
<PackageReference Include="RockHopper" Version="1.0.1" />
<PackageVersion Include="RockHopper" Version="1.0.1" />
<PackageReference Include="RockHopper" />
paket add RockHopper --version 1.0.1
#r "nuget: RockHopper, 1.0.1"
#:package RockHopper@1.0.1
#addin nuget:?package=RockHopper&version=1.0.1
#tool nuget:?package=RockHopper&version=1.0.1
RockHopper
Provides a simple way to build a test subject with its mock dependencies. Backed by the Castle Core assembly for proxy generation, this framework supports both constructor and property dependencies.
The mock framework supports strict mocking only. There is no support for loose mocks. This means that you have to provide a matching mock setup for any calls made to mocks. This is by design to enforce deliberate enforcement of good test practices.
Getting Started
For a simple example, you can use your favourite unit test framework and add the following code to test:
public abstract class Calculator
{
public abstract int Add(int x, int y);
}
public sealed class CalculatorService
{
private readonly Calculator _calculator;
public CalculatorService(Calculator calculator)
{
_calculator = calculator;
}
public int AddNumbers(int x, int y)
{
return _calculator.Add(x, y);
}
}
and then write a test (using XUnit for example):
public class CalculatorServiceTests
{
[Fact]
public void TwoNumbers_AddNumbers_ReturnsSum()
{
// Arrange
var calculatorService = TestSubject.Create<CalculatorService>();
var calculator = calculatorService.GetMock<Calculator>();
calculator.Function(c => c.Add(1, 2)).Returns(3);
// Act
var sum = calculatorService.AddNumbers(1, 2);
// Assert
Assert.Equal(3, sum);
}
}
More
- GitHub for project: https://github.com/hypersolutions/rockhopper/
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- Castle.Core (>= 5.2.1)
-
net9.0
- Castle.Core (>= 5.2.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.