Example #1
0
        public void When_decider_says_Stop_Then_the_actor_is_Stopped_but_not_the_siblings()
        {
            var strategy         = new OneForOneSupervisorStrategy(exception => SupervisorAction.Stop);
            var actor            = A.Fake <InternalActorRef>();
            var sibling          = A.Fake <InternalActorRef>();
            var actorRestartInfo = new ChildRestartInfo(actor);
            var actorAndSiblings = new List <ChildRestartInfo> {
                new ChildRestartInfo(sibling), actorRestartInfo
            };
            var failureHandled = strategy.HandleFailure(actorRestartInfo, new Exception(), actorAndSiblings);

            failureHandled.Should().BeTrue();
            A.CallTo(() => actor.Stop()).MustHaveHappened(Repeated.Exactly.Once);
            A.CallTo(() => sibling.Stop()).MustNotHaveHappened();
        }
Example #2
0
        public void When_decider_says_Escalate_Then_no_calls_are_made_to_actor_and_false_is_returned()
        {
            var strategy         = new OneForOneSupervisorStrategy(exception => SupervisorAction.Escalate);
            var actor            = A.Fake <InternalActorRef>();
            var sibling          = A.Fake <InternalActorRef>();
            var actorRestartInfo = new ChildRestartInfo(actor);
            var actorAndSiblings = new List <ChildRestartInfo> {
                new ChildRestartInfo(sibling), actorRestartInfo
            };
            var failureHandled = strategy.HandleFailure(actorRestartInfo, new Exception(), actorAndSiblings);

            failureHandled.Should().BeFalse();
            A.CallTo(actor).MustNotHaveHappened();
            A.CallTo(sibling).MustNotHaveHappened();
        }