I am unit-testing an actor that uses the Cluster tool DistributedPubSub
. For the tests I am using the TestKit of Akka.net.
Apparently, in the TestKit, the system actor Sys
doesn't have the DistributedPubSub
tool and it throws a Null pointer exception when accessing it.
This is the code failing when the actor is created as child of Sys:
var mediador = DistributedPubSub.Get(Context.System).Mediator;
Is there a way to mock it or create an actor probe to use it with Sys
?
I think the issue is here that you need to specify the following in your HOCON when you pass it to the base class constructor, when working with any of the TestKit classes:
I added a pull request to test for this issue on Akka.NET here and the spec passes: https://github.com/akkadotnet/akka.net/pull/2424