-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Version: 1.3.15
There have been a number of questions over the years regarding this, but I think I have an idea on how to solve this long-standing issue: how can I get programmatic access to child actors inside a TestKit test?
I think the answer lies in making some changes to the InternalTestActorRef interface and the TestActorCell:
akka.net/src/core/Akka.TestKit/Internal/InternalTestActorRef.cs
Lines 70 to 73 in 0a8c039
| protected TestActorCell GetTestActorCell() | |
| { | |
| return (TestActorCell)Cell; | |
| } |
I think we can expose any of the children created by an InternalTestActorRef in a collection property on the InternalTestActorRef interface itself, so any actor that was started in a unit test via the ActorOfAsTestActorRef<TActor> method will also create its children as InternalTestActorRef.
Doing this should require changing the TestActorCell.ActorOf method and the InternalTestActorRef interface mainly and would give developers underlying access to the children created by TestActorRef actors, including the Underlying actor instance too.