Example #1
0
        public void Given_a_timed_out_instance_When_sending_messages_to_it_Then_messages_are_forwarded_to_deadLetter()
        {
            var deadLetterActor  = A.Fake <ActorRef>();
            var testBootstrapper = new TestBootstrapper()
            {
                DeadLetterActorCreator = (path, system) => deadLetterActor
            };
            var actorSystem = testBootstrapper.CreateSystem();


            var promiseActorRef = PromiseActorRef.Create(actorSystem, 10, "target");

            try{ promiseActorRef.Future.Wait(); }
            catch (Exception) {}

            var fakeSender = A.Fake <ActorRef>();
            var message1   = new object();
            var message2   = new object();

            promiseActorRef.Send(message1, fakeSender);
            promiseActorRef.Send(message2, fakeSender);

            A.CallTo(() => deadLetterActor.Send(message1, fakeSender)).MustHaveHappened(Repeated.Exactly.Once);
            A.CallTo(() => deadLetterActor.Send(message2, fakeSender)).MustHaveHappened(Repeated.Exactly.Once);
        }