Closed sixten closed 2 years ago
You're aboslutely right – it's pretty awkward how it works now.
I've changed the ctor to have this signature:
public FakeMessageContext(
TransportMessage transportMessage = null,
Message message = null,
CancellationToken cancellationToken = default
)
thus making it possible to pass in any of the desired objects. It's out as Rebus.TestHelpers 7.0.0, which is available on NuGet.org now 🙂 thanks for briging it to my attention!
I can understand why the
FakeMessageContext
doesn't contain a validIncomingStepContext
, but that unfortunately means thatMessageContextExtensions.GetCancellationToken()
doesn't work with the fake context. Because that's an extension method, it's also kind of difficult to get around this by mocking the message context.Do you have any suggestions for testing handlers that use the cancellation token?