-
-
Notifications
You must be signed in to change notification settings - Fork 457
Open
Labels
Description
I am using the Publish()
method on sagas, but I am not sure how to write a unit test that verifies the method is being called. My goal is to ensure that if someone removes it from the code, the unit test will fail.
My suggestion is to expose the _unpublishedCommands
list in AggregateSaga
through a public property, similar to how the _uncommittedEvents
field is exposed in AggregateRoot
.
For example:
public IEnumerable<IUncommittedEvent> UnpublishedCommands => _unpublishedCommands;
Would this be a good solution, or is there a specific reason why this property should remain private?
If keeping it private is intentional, is there another recommended way to unit test that Publish()
is being called?
Luuck4s and TiagoBrazSantos