0

After I create a ActorSystem and a WorkerActor I schedule some message to be sent every 5 minutes:

_actorSystem.Scheduler.ScheduleTellRepeatedly(
    TimeSpan.FromSeconds(10), TimeSpan.FromMinutes(5), 
    workerActor, new MyMessage(), Nobody.Instance);

How would one test this using TestKit?

I have found this article: https://petabridge.com/blog/how-to-unit-test-akkadotnet-actors-akka-testkit/

The example "How do I test scheduled messages?" at the end of the article shows how to advance the virtual time so the test not waits X minutes. Unfortunately, it actually tests that Actor sends messages on schedule not receives them.

Nkosi
  • 235,767
  • 35
  • 427
  • 472
Michael D.
  • 1,249
  • 2
  • 25
  • 44
  • Check https://stackoverflow.com/questions/30730706/how-to-use-testkit-in-akka-net?rq=1 – Nkosi Feb 12 '18 at 02:01
  • https://stackoverflow.com/questions/31103148/akka-net-and-unit-tests?rq=1 – Nkosi Feb 12 '18 at 02:04
  • @Nkosi, I saw those answers already. Do you want to say that what I am trying to achieve is impossible unless my WorkerActor sends out some messages? The problem here this is leaf actor that just do some work on schedule and does not communicate with any other actors. Even the sender of the message is `Nobody.Instance` – Michael D. Feb 12 '18 at 02:24

0 Answers0