Ejemplo n.º 1
0
        public void SelfStopActorTest()
        {
            bool f = false;

            var acts = new ActorSystem();
            var act = acts.CreateActor<SimpleTestActor>();
            var sm = new stopmsg();
            var tsk = act.Ask<int>(sm);
            try
            {
                tsk.Wait();
            }
            catch { }
            var m = new acttestmsg()
            {
                act = () =>
                {
                    f = true;
                    return 0;
                },
                msg = "test message"
            };

            tsk = act.Ask<int>(m);
            try
            {
                tsk.Wait();
            }
            catch (AggregateException e) { }

            Assert.IsFalse(f);
            Assert.IsNotNull(tsk.Exception);
            Console.WriteLine("test complete");
        }
Ejemplo n.º 2
0
 public int handler4(stopmsg msg)
 {
     Context.StopActor(Context.Self);
     return 10;
 }