RabbitMQ.Fakes.DotNetStandard is a .NET Standard 2.0 library (forked from the RabbitMQ.Fakes library) that contains fake implementations of the interfaces defined in the RabbitMQ.Client library.
The implementation is entirely in-memory, which eliminates the dependency on a live RabbitMQ server for unit testing.
NOTE: This library is inteded to be used for testing purposes, only (a la Microsoft.EntityFrameworkCore.InMemory).
RabbitMQ.Fakes is a .NET Framework 4.5 library, which is only compatible with .NET Framework.
RabbitMQ.Fakes.DotNetStandard is a .NET Standard 2.0 library, which is compatible with both .NET Framework and .NET Core.
RabbitMQ.Fakes.DotNetStandard has a dependency on the RabbitMQ.Client library.
This may cause conflicts if you are referencing RabbitMQ.Fakes.DotNetStandard and RabbitMQ.Client (e.g. in a test project) with different versions of RabbitMQ.Client.
Below is a table of the version mappings between RabbitMQ.Fakes.DotNetStandard and RabbitMQ.Client.
RabbitMQ.Fakes.DotNetStandard Version | RabbitMQ.Client Version |
---|---|
1.0.1 - 1.0.4 | 5.1.0 |
2.0.0+ | 6.2.1 |
- .NET runtime that supports .NET standard 2.0 libraries
- .NET Core 2.0+
- .NET Framework 4.6.1+ (Technically the minimum version supported, but you should use .NET Framework 4.7.2+. See the previous link.)
- Nuget Package Manger
- RabbitMQ.Fakes.DotNetStandard: Implementation of the fakes using .NET Standard 2.0.
- RabbitMQ.Fakes.DotNetCoreTests: Unit tests around the fake implementation using .NET Core 3.1.
- RabbitServer: In memory representation of a RabbitMQ server. This is where the Exchanges / Queues / Bindings / Messages are held.
- FakeConnectionFactory: Fake implementation of the RabbitMQ
IConnectionFactory
. Returns aFakeConnection
when theCreateConnection()
method is called. - FakeConnection: Fake implementation of the RabbitMQ
IConnection
. Returns aFakeModel
when theCreateModel()
method is called. - FakeModel: Fake implementation of the RabbitMQ
IModel
. Interacts with theRabbitServer
instance passed into theFakeConnectionFactory
.
See the UseCases in the RabbitMQ.Fakes.DotNetCoreTests project for sample usage.