C
C#12mo ago
OukiShogun

❔ Should I test my mediator class ?

Hello, Should I Test my mediator class ? I ask the question because it manage interaction between domaines services. PS : I don't use MediatR
6 Replies
Pobiega
Pobiega12mo ago
Is this a self-made mediator that does roughly what MediatR does? If so, I'd expect you to have tests in place that validate order of operations and transactional security etc
OukiShogun
OukiShogun12mo ago
I never test médiatR. To be exact, I confuse observer pattern and mediator pattern. My implémentation has two functions. Notify() and subscribe()
Pobiega
Pobiega12mo ago
Okay, so its a message bus? I mean, yeah write some basic tests that verify that it does what it should. ie, register a subscription for X, verify that when Notify(X) is called, the subscriber gets informed
OukiShogun
OukiShogun12mo ago
Yes a message bus. Do you think that I should rename the interface IMediator to IMessageBus
Pobiega
Pobiega12mo ago
¯\_(ツ)_/¯ Your call
Accord
Accord12mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.