public void PostStopErrTest() { Exception e = null; var acts = new ActorSystem(); var act = acts.CreateActor<RestartFaultActor>(); try { acts.StopActor(act); } catch (Exception ex) { e = ex; } Assert.IsNull(e); }
public void ChildHasStopedOrRestartedOnlyByParent() { var actf = new ActorSystem(); var act1 = actf.CreateActor<IerarhyTestActorOvveride>(); var tsk = act1.Ask<ActorRef>(new createchildactormsg()); tsk.Wait(); var act2 = tsk.Result; Assert.IsNotNull(act2); bool f = false; try { actf.StopActor(act2); } catch { f = true; } Assert.IsTrue(f); f = false; try { actf.RestartActor(act2); } catch { f = true; } Assert.IsTrue(f); }
public void SimpleTestStopActor() { bool f = false; var acts = new ActorSystem(); var act = acts.CreateActor<SimpleTestActor>(); acts.StopActor(act); var m = new acttestmsg() { act = () => { f = true; return 0; }, msg = "test message" }; var tsk = act.Ask<int>(m); try { tsk.Wait(); } catch (AggregateException e) { } Assert.IsFalse(f); Assert.IsNotNull(tsk.Exception); Console.WriteLine("test complete"); }
public void PostStopTest() { bool f = false; var acts = new ActorSystem(); var act = acts.CreateActor<IntoTestActor>(); var m = new poststoptestmsg() { poststop = () => { f = true; } }; var tsk = act.Ask<int>(m); tsk.Wait(); Assert.IsFalse(f); acts.StopActor(act); Assert.IsTrue(f); }
public void StopParentStoppingChilds() { var actf = new ActorSystem(); var act1 = actf.CreateActor<IerarhyTestActor>(); var tsk = act1.Ask<ActorRef>(new createchildactormsg()); tsk.Wait(); var act2 = tsk.Result; Assert.IsNotNull(act2); actf.StopActor(act1); bool f = false; try { act1.Ask<int>(new acttestmsg() { act = () => { return 0; } }) .Wait(100); } catch { f = true; } Assert.IsTrue(f); f = false; try { act2.Ask<int>(new acttestmsg() { act = () => { return 0; } }) .Wait(100); } catch { f = true; } Assert.IsTrue(f); }