AutoFixture.AutoRhinoMock is an extension for AutoFixture that turns your fixture into an auto-mocking container using Rhino Mocks. It automates the creation of mocks for abstract classes and interfaces, letting you focus on your test's intent instead of tedious setup.
AutoFixture packages are distributed via NuGet.
To install the packages you can use the integrated package manager of your IDE, the .NET CLI, or reference the package directly in your project file.
dotnet add package AutoFixture.AutoRhinoMocks --version x.x.x
<PackageReference Include="AutoFixture.AutoRhinoMocks" Version="x.x.x" />
AutoFixture offers a variety of utility packages and integrations with most of the major mocking libraries and testing frameworks.
Simply install the NuGet package and customize your fixture:
// Customize the fixture to use Rhino Mocks:
var fixture = new Fixture().Customize(new AutoRhinoMockCustomization());
// Freeze a dependency to configure its behavior:
var fooMock = (IMockedObject)fixture.Freeze<IFoo>();
// Create your SUT; its dependencies are auto-mocked using Rhino Mocks:
var sut = fixture.Create<MyService>();
AutoFixture offers a variety of utility packages and integrations with most of the major mocking libraries and testing frameworks.
Note
Since AutoFixture tries maintain compatibility with a large number of package versions, the packages bundled with AutoFixture might not contain the latest features of your (e.g. mocking) library.
Make sure to install the latest version of the integrated library package, alongside the AutoFixture packages.
The core packages offer the full set of AutoFixture's features without requring any testing framework or third party integration.
Product | Package | Stable | Preview | Downloads |
---|---|---|---|---|
The core package | AutoFixture | |||
Assertion idioms | AutoFixture.Idioms | |||
Seed extensions | AutoFixture.SeedExtensions |
AutoFixture offers integations with most major .NET mocking libraries.
These integrations enable such features as configuring mocks, auto-injecting mocks, etc.
Product | Package | Stable | Preview | Downloads |
---|---|---|---|---|
Moq | AutoFixture.AutoMoq | |||
NSubstitute | AutoFixture.AutoNSubstitute | |||
FakeItEasy | AutoFixture.AutoFakeItEasy | |||
Rhino Mocks | AutoFixture.AutoRhinoMocks |
AutoFixture offers integrations with most major .NET testing frameworks.
These integrations enable auto-generation of test cases, combining auto-generated data with inline arguments, etc.
Product | Package | Stable | Preview | Downloads |
---|---|---|---|---|
xUnit v3 | AutoFixture.Xunit3 | |||
xUnit v2 | AutoFixture.Xunit2 | |||
xUnit v1 | AutoFixture.Xunit | |||
NUnit v4 | AutoFixture.NUnit4 | |||
NUnit v3 | AutoFixture.NUnit3 | |||
NUnit v2 | AutoFixture.NUnit2 | |||
Foq | AutoFixture.AutoFoq |
You can check the compatibility with your target framework version on the wiki or on the NuGet website.
Contributions are welcome! If you would like to contribute, please review our contributing guidelines and open an issue or pull request.
AutoFixture is Open Source software and is released under the MIT license.
The licenses allows the use of AutoFixture libraries in free and commercial applications and libraries without restrictions.
This project is supported by the .NET Foundation.