Пример #1
0
        public void TestProbeParentActor_SupervisorStrategyWithDeciderThatReturnsRestart_RestartsChild()
        {
            //act
            TestProbeParentActor sut = CreateTestProbeParentActor().UnderlyingActor;

            //assert
            TestActorRef <DummyChildActor> child = ActorOfAsTestActorRef <DummyChildActor>(sut.Ref);

            child.Tell(RestartChildException);
            child.Tell(new object());
            ExpectMsg(DummyChildActor.ReplyAfterRestart);
        }
Пример #2
0
        public void TestProbeParentActor_SupervisorStrategyWithDeciderThatReturnsStop_StopsChild()
        {
            //act
            TestProbeParentActor sut = CreateTestProbeParentActor().UnderlyingActor;

            //assert
            TestActorRef <DummyChildActor> child = ActorOfAsTestActorRef <DummyChildActor>(sut.Ref);

            Watch(child);
            child.Tell(StopChildException);
            ExpectTerminated(child);
        }
Пример #3
0
        public void TestProbeParentActor_SupervisorStrategy_ResolvesEventInExceptionWaiter()
        {
            //act
            TestProbeParentActor sut = CreateTestProbeParentActor().UnderlyingActor;

            //assert
            TestActorRef <DummyChildActor> child = ActorOfAsTestActorRef <DummyChildActor>(sut.Ref);

            child.Tell(RestartChildException);
            AwaitAssert(() => ExceptionWaiterMock.Verify(
                            waiter => waiter.ResolveEvent(),
                            Times.Once));
        }
        public void TestProbeChildActorUnhandledExceptions_ReturnsEmptyResultWhenNoExceptionsHaveBeenThrown()
        {
            //arrange
            TestProbeParentActor           sut   = CreateTestProbeParentActor().UnderlyingActor;
            TestActorRef <DummyChildActor> child = ActorOfAsTestActorRef <DummyChildActor>(sut.Ref);

            child.Tell(new object());

            //act
            IEnumerable <Exception> result = sut.UnhandledExceptions;

            //assert
            result.Should().BeEmpty();
        }
        public void TestProbeChildActorUnhandledExceptions_ReturnsCorrectResultWhenMultipleExceptionsHaveBeenThrown()
        {
            //arrange
            TestProbeParentActor           sut   = CreateTestProbeParentActor().UnderlyingActor;
            TestActorRef <DummyChildActor> child = ActorOfAsTestActorRef <DummyChildActor>(sut.Ref);

            child.Tell(RestartChildException);
            child.Tell(RestartChildException);
            child.Tell(StopChildException);

            //act
            IEnumerable <Exception> result = sut.UnhandledExceptions;

            //assert
            result.Should().BeEquivalentTo(
                RestartChildException,
                RestartChildException,
                StopChildException);
        }