Unit testing internal message handlers

In my NServiceBus Azure Function project, all my Commands and Events and corresponding Handlers are public. But all Messages and its Handlers are internal. I’m looking for a way to test these internal handlers by using NServiceBus.Testing framework.

Hi,

Could you please elaborate on what kind of tests you have in mind? Mentioning internal handlers makes me think you just need to ‘access’ the handler in your unit test assembly. If that’s all that’s needed, wouldn’t the old InternalVisibleTo suffice?

Regards,
Hadi

your handlers and messages are not a public api, ie they are not consumed by an external assembly. so there is no harm in making handlers and messages public for testing purposes

1 Like