Inheritance: UnboundedMailbox
コード例 #1
0
        public void CleanUp_drains_queue()
        {
            using (var loggerMailbox = new LoggerMailbox())
            {
                loggerMailbox.Post(TestActor, new Envelope {Message = "foo", Sender = TestActor});

                loggerMailbox.NumberOfMessages.ShouldBe(1);

                loggerMailbox.CleanUp();

                loggerMailbox.NumberOfMessages.ShouldBe(0);
            }
        }
コード例 #2
0
        public void CleanUp_drains_queue()
        {
            var loggerMailbox = new LoggerMailbox(ActorRefs.Nobody, Sys);
            loggerMailbox.SetActor((ActorCell)TestActor.AsInstanceOf<ActorRefWithCell>().Underlying); // mailboxes won't cleanup without an actorcell set
            loggerMailbox.Enqueue(TestActor, new Envelope("foo", TestActor));

            loggerMailbox.NumberOfMessages.ShouldBe(1);

            loggerMailbox.CleanUp();

            loggerMailbox.NumberOfMessages.ShouldBe(0);

        }