private async Task <RoleClaimsActor> CreateActor(IActorStateManager actorStateManager, string id) { var uniqueIndexActor = new Mock <IUniqueIndexActor>(); var eventBus = new Mock <IEventBus>(); var eventStore = new Mock <IEventStore>(); var actorTypeInformation = ActorTypeInformation.Get(typeof(RoleClaimsActor)); RoleClaimsActor actorFactory(ActorService service, ActorId id) => new RoleClaimsActor(service, id, eventBus.Object, eventStore.Object, actorStateManager); var actorService = new ActorService(actorTypeInformation, actorFactory); RoleClaimsActor actor = actorFactory(actorService, new ActorId(id)); MethodInfo OnActivate = actor.GetType().GetMethod("OnActivateAsync", BindingFlags.NonPublic | BindingFlags.Instance); await(Task) OnActivate.Invoke(actor, Array.Empty <object>()); return(actor); }