Akka.Tests.Actor.DeathWatchSpec.DeathWatch_must_fail_a_monitor_which_doesnt_handle_Terminated C# (CSharp) Метод

DeathWatch_must_fail_a_monitor_which_doesnt_handle_Terminated() приватный Метод

private DeathWatch_must_fail_a_monitor_which_doesnt_handle_Terminated ( ) : void
Результат void
        public void DeathWatch_must_fail_a_monitor_which_doesnt_handle_Terminated()
        {
            EventFilter.Exception<ActorKilledException>().And.Exception<DeathPactException>().Expect(2, () =>
            {
                var strategy = new FailedSupervisorStrategy(TestActor);
                _supervisor = Sys.ActorOf(Props.Create(() => new Supervisor(strategy)).WithDeploy(Deploy.Local));

                var failed = _supervisor.Ask(Props.Empty).Result as IActorRef;
                var brother = _supervisor.Ask(Props.Create(() => new BrotherActor(failed))).Result as IActorRef;

                StartWatching(brother);

                failed.Tell(Kill.Instance);
                var result = ReceiveWhile(TimeSpan.FromSeconds(5), msg =>
                {
                    var res = 0;
                    msg.Match()
                        .With<FF>(ff =>
                        {
                            if (ff.Fail.Cause is ActorKilledException && ff.Fail.Child == failed) res = 1;
                            if (ff.Fail.Cause is DeathPactException && ff.Fail.Child == brother) res = 2;
                        })
                        .With<WrappedTerminated>(x => res = x.Terminated.ActorRef == brother ? 3 : 0);
                    return res.ToString();
                }, 3);

                ((IInternalActorRef)TestActor).IsTerminated.ShouldBe(false);
                result.ShouldOnlyContainInOrder("1", "2", "3");
            });
        }