| | 1 | | using System; |
| | 2 | | using Akka.Actor; |
| | 3 | | using Akka.DependencyInjection; |
| | 4 | | using Microsoft.Extensions.DependencyInjection; |
| | 5 | | using SeungYongShim.Akka.DependencyInjection.Abstractions; |
| | 6 | |
|
| | 7 | | namespace SeungYongShim.Akka.DependencyInjection |
| | 8 | | { |
| | 9 | |
|
| | 10 | | internal class FakePropsFactory<T> : IPropsFactory<T> where T : ActorBase |
| | 11 | | { |
| | 12 | | public FakePropsFactory(ActorSystem actorSystem) => ActorSystem = actorSystem; |
| | 13 | |
|
| | 14 | | public ActorSystem ActorSystem { get; } |
| | 15 | |
|
| | 16 | | public Props Create(params object[] args) => |
| | 17 | | DependencyResolver.For(ActorSystem).Props<FakeActor>(args); |
| | 18 | | } |
| | 19 | |
|
| | 20 | | internal class FakeActor : ReceiveActor |
| | 21 | | { |
| 3 | 22 | | public FakeActor(IServiceProvider sp) : this(sp, default) { } |
| 0 | 23 | | public FakeActor(IServiceProvider sp, object o1) : this(sp, o1, default) { } |
| 0 | 24 | | public FakeActor(IServiceProvider sp, object o1, object o2) : this(sp, o1, o2, default) { } |
| 0 | 25 | | public FakeActor(IServiceProvider sp, object o1, object o2, object o3) : this(sp, o1, o2, o3, default) { } |
| 0 | 26 | | public FakeActor(IServiceProvider sp, object o1, object o2, object o3, object o4) : this(sp, o1, o2, o3, o4, def |
| 1 | 27 | | private FakeActor(IServiceProvider sp, params object[] args) |
| 1 | 28 | | { |
| 1 | 29 | | var testActor = sp.GetService<GetTestActor>()(); |
| 1 | 30 | | ReceiveAny(testActor.Forward); |
| 1 | 31 | | } |
| | 32 | | } |
| | 33 | | } |