C
C#2y 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
Pobiega2y 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
OukiShogunOP2y 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
Pobiega2y 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
OukiShogunOP2y ago
Yes a message bus. Do you think that I should rename the interface IMediator to IMessageBus
Pobiega
Pobiega2y ago
¯\_(ツ)_/¯ Your call
Accord
Accord2y 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.

Did you find this page helpful?