Exemple #1
0
        public void When_handling_non_existing_SystemMessage_then_Exception_is_thrown()
        {
            var mailbox           = A.Fake <Mailbox>();
            var actorInstantiator = A.Fake <ActorInstantiator>();
            var actorRef          = new TestLocalActorRef(new TestActorSystem(), actorInstantiator, new RootActorPath("test"), mailbox, A.Dummy <InternalActorRef>());

            actorRef.HandleSystemMessage(new SystemMessageEnvelope(actorRef, new NonExistingSystemMessage(), A.Fake <ActorRef>()));
            actorRef.EscalatedErrors.Count.Should().Be(1);
            actorRef.EscalatedErrors[0].Should().BeOfType <InvalidOperationException>();
        }
Exemple #2
0
        public void When_handling_CreateActor_message_and_the_ActorInstantiator_returns_null_then_error_is_escalated()
        {
            var mailbox           = A.Fake <Mailbox>();
            var actorInstantiator = A.Fake <ActorInstantiator>();

            A.CallTo(() => actorInstantiator.CreateNewActor()).Returns(null);
            var actorRef = new TestLocalActorRef(new TestActorSystem(), actorInstantiator, new RootActorPath("test"), mailbox, A.Dummy <InternalActorRef>());

            actorRef.HandleSystemMessage(new SystemMessageEnvelope(actorRef, new CreateActor(), A.Fake <ActorRef>()));
            actorRef.EscalatedErrors.Count.Should().Be(1);
            actorRef.EscalatedErrors[0].Should().BeOfType <CreateActorFailedException>();
        }