public void InitialStateIsStart() { var testKit = new TestKit(); var fsmActor = testKit.ActorOfAsTestActorRef <FsmBecomeActor>(); Assert.AreEqual(FsmActorState.Start, fsmActor.UnderlyingActor.State); }
public void AfterOfferIsOffered() { var testKit = new TestKit(); var fsmActor = testKit.ActorOfAsTestActorRef <FsmBecomeActor>(); fsmActor.Tell("offer"); Assert.AreEqual(FsmActorState.Offered, fsmActor.UnderlyingActor.State); }
public static async Task <T> LoadActor <T>(this TestKit kit, string name) where T : ActorBase { var diActorSystemAdapter = kit.Sys.DI(); var props = diActorSystemAdapter.Props <T>(); var actor = kit.ActorOfAsTestActorRef <T>(props, name); await actor.Ask <RecoveryCompleted>(NotifyOnPersistenceEvents.Instance, TimeSpan.FromSeconds(5)); return(actor.UnderlyingActor); }
public void SqlEventSnapShotJournal() { var testSystem = new TestKit(Config, "sql"); var persistor = testSystem.ActorOfAsTestActorRef <SqlPersistenceTests.SqlTestActor>(Props.Create(() => new SqlPersistenceTests.SqlTestActor("SomeTest"))); var probe = testSystem.CreateTestProbe("testies"); persistor.Tell(new SqlPersistenceTests.SqlTestActor.Incrementor(10), probe); persistor.Tell(new SqlPersistenceTests.SqlTestActor.RequestCurrentValue(), probe); var result = probe.ExpectMsg <SqlPersistenceTests.SqlTestActor.IncrementorResult>(); Assert.AreEqual(10, result.Value); testSystem.Shutdown(TimeSpan.FromSeconds(5), true); testSystem = new TestKit(Config, "sql"); persistor = testSystem.ActorOfAsTestActorRef <SqlPersistenceTests.SqlTestActor>(Props.Create(() => new SqlPersistenceTests.SqlTestActor("SomeTest"))); probe = testSystem.CreateTestProbe("testies2"); persistor.Tell(new SqlPersistenceTests.SqlTestActor.RequestCurrentValue(), probe); result = probe.ExpectMsg <SqlPersistenceTests.SqlTestActor.IncrementorResult>(); Assert.AreEqual(10, result.Value); persistor.Tell("snap", probe); persistor.Tell(new SqlPersistenceTests.SqlTestActor.Incrementor(10), probe); persistor.Tell(new SqlPersistenceTests.SqlTestActor.RequestCurrentValue(), probe); result = probe.ExpectMsg <SqlPersistenceTests.SqlTestActor.IncrementorResult>(); Assert.AreEqual(20, result.Value); testSystem.Shutdown(TimeSpan.FromSeconds(5), true); testSystem = new TestKit(Config, "sql"); persistor = testSystem.ActorOfAsTestActorRef <SqlPersistenceTests.SqlTestActor>(Props.Create(() => new SqlPersistenceTests.SqlTestActor("SomeTest"))); probe = testSystem.CreateTestProbe("testies3"); persistor.Tell(new SqlPersistenceTests.SqlTestActor.RequestCurrentValue(), probe); result = probe.ExpectMsg <SqlPersistenceTests.SqlTestActor.IncrementorResult>(); Assert.AreEqual(20, result.Value); }