public void FSMActor_must_cancel_all_timers_when_terminated() { var timerNames = new List <string> { "timer-1", "timer-2", "timer-3" }; var fsmRef = new TestFSMRef <StopTimersFSM, string, object>(Sys, Props.Create( () => new StopTimersFSM(TestActor, timerNames))); Action <bool> checkTimersActive = active => { foreach (var timer in timerNames) { fsmRef.IsTimerActive(timer).Should().Be(active); fsmRef.IsStateTimerActive().Should().Be(active); } }; checkTimersActive(false); fsmRef.Tell("start"); ExpectMsg("starting", 1.Seconds()); checkTimersActive(true); fsmRef.Tell("stop"); ExpectMsg("stopped", 1.Seconds()); }
public void TestFsmActorRef_must_proxy_receive_for_underlying_actor_with_sender() { var a = new TestFSMRef <FsmActor, TestFsmState, string>(Sys, Props.Create(() => new FsmActor(TestActor))); a.Receive("check"); ExpectMsg("first"); // verify that we can change state a.SetState(TestFsmState.Last); a.Receive("check"); ExpectMsg("last"); }