LSL.FluentAssertions.Rebus
1.0.4
dotnet add package LSL.FluentAssertions.Rebus --version 1.0.4
NuGet\Install-Package LSL.FluentAssertions.Rebus -Version 1.0.4
<PackageReference Include="LSL.FluentAssertions.Rebus" Version="1.0.4" />
paket add LSL.FluentAssertions.Rebus --version 1.0.4
#r "nuget: LSL.FluentAssertions.Rebus, 1.0.4"
// Install LSL.FluentAssertions.Rebus as a Cake Addin #addin nuget:?package=LSL.FluentAssertions.Rebus&version=1.0.4 // Install LSL.FluentAssertions.Rebus as a Cake Tool #tool nuget:?package=LSL.FluentAssertions.Rebus&version=1.0.4
LSL.FluentAssertions.Rebus
A convenience library to short cut common assertions when using the Rebus.TestHelpers library.
Each of the HaveXXX
methods returns a the standard collection assertion object provided by FluentAssertions
Simple assertion of a sent message
As we can see in the following example we are just asserting the message content via the regular collection assertion method SatisfyRespectively
that is provided by FluentAsserttions
using LSL.FluentAssertions.Rebus;
...
var bus = new FakeBus();
bus.Send("a message");
bus.Should().HaveMessageCount(1)
.And
.HaveSentMessages<string>()
.And
.SatisfyRespectively(m => m.CommandMessage.Should().Be("a message"));
Testing for multiple messages
Here we assert against a sent message and a published event.
NOTE: Since each method returns the underlying message type supported by
Rebus.TestHelpers
we had to useCommandMessage
to access the sent message andEventMessage
to access the published event.
using LSL.FluentAssertions.Rebus;
...
var bus = new FakeBus();
bus.Send("a message");
bus.Publish("an event");
bus.Should().HaveMessageCount(2);
bus.Should().HaveSentMessages<string>()
.And.SatisfyRespectively(m => m.CommandMessage.Should().Be("a message"));
bus.Should().HavePublishedMessages<string>()
.And.SatisfyRespectively(m => m.EventMessage.Should().Be("an event"));
Assertion method mappings to Rebus
The following table outlines what type of message is returned by each assertion method.
Method | Rebus.TestHelpers MessageType | Generated by |
---|---|---|
HaveDeferredMessages | MessageDeferred<T> | bus.Defer(TimeSpan.Max, "msg") |
HaveDeferredToDesinationMessages | MessageDeferredToDestination<T> | bus.Advanced.Routing.Defer("queue", TimeSpan.Max, "msg") |
HaveDeferredToSelfMessages | MessageDeferredToSelf<T> | bus.DeferLocal(TimeSpan.Max, "msg") |
HavePublishedMessages | MessagePublished<T> | bus.Publish("event") |
HavePublishedToTopicMessages | MessagePublishedToTopic<T> | bus.Advanced.Topics.Publish("topic", "event") |
HaveSentMessages | MessageSent<T> | bus.Send("msg") |
HaveSentToDestinationMessages | MessageSentToDestination<T> | bus.Advanced.Routing.Send("queue", "msg") |
HaveSentToSelfMessages | MessageSentToSelf<T> | bus.SendLocal("msg") |
HaveSentWithRoutingSlipMessages | MessageSentWithRoutingSlip | bus.Advanced.Routing.SendRoutingSlip(new Itinerary(), "msg") |
Product | Versions 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. |
-
.NETStandard 2.0
- FluentAssertions (>= 6.0.0)
- Rebus.TestHelpers (>= 6.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.