public MockableActorRegistration( Func <ActorService, ActorId, TActorImplementation> activator, CreateStateManager createStateManager = null, CreateStateProvider createStateProvider = null) { InterfaceType = typeof(TActorInterface); ImplementationType = typeof(TActorImplementation); Activator = activator; CreateStateManager = createStateManager; CreateStateProvider = createStateProvider; CreateActorService = null; }
public void SetupActor <TActorImplementation>( Func <ActorService, ActorId, TActorImplementation> activator, CreateStateManager createStateManager = null, CreateStateProvider createStateProvider = null) where TActorImplementation : class, IActor { var actorInterface = typeof(TActorImplementation).IsInterface ? typeof(TActorImplementation) : typeof(TActorImplementation).GetInterfaces().FirstOrDefault(i => i.GetInterfaces().Any(i2 => i2 == typeof(IActor))); var actorRegistration = new MockableActorRegistration(actorInterface, typeof(TActorImplementation), activator, createStateManager, createStateProvider); ((MockActorProxyFactory)ActorProxyFactory).AddActorRegistration(actorRegistration); }
public void SetupActor <TActorImplementation, TActorService>( Func <TActorService, ActorId, TActorImplementation> activator, CreateActorService <TActorService> createActorService, CreateStateManager createStateManager = null, CreateStateProvider createStateProvider = null) where TActorImplementation : class, IActor where TActorService : ActorService { var actorInterface = typeof(TActorImplementation).IsInterface ? typeof(TActorImplementation) : typeof(TActorImplementation).GetInterfaces().FirstOrDefault(i => i.GetInterfaces().Any(i2 => i2 == typeof(IActor))); var actorRegistration = new MockableActorRegistration <TActorService>( interfaceType: actorInterface, implementationType: typeof(TActorImplementation), createActorService: createActorService, activator: (Func <ActorService, ActorId, TActorImplementation>)((actorService, actorId) => activator((TActorService)actorService, actorId)), createStateManager: createStateManager, createStateProvider: createStateProvider); ((MockActorProxyFactory)ActorProxyFactory).AddActorRegistration(actorRegistration); }