Esempio n. 1
0
        public void The_retry_count_should_be_set_on_the_message()
        {
            var future = new FutureMessage <PingMessage>();

            bool first = true;

            LocalBus.SubscribeHandler <PingMessage>(message =>
            {
                if (first)
                {
                    Assert.AreEqual(0, LocalBus.Context().RetryCount);

                    LocalBus.MessageContext <PingMessage>().RetryLater();

                    first = false;
                }
                else
                {
                    Assert.AreEqual(1, LocalBus.Context().RetryCount);

                    future.Set(message);
                }
            });

            LocalBus.ShouldHaveRemoteSubscriptionFor <PingMessage>();

            LocalBus.Publish(new PingMessage());

            Assert.IsTrue(future.IsAvailable(20.Seconds()));
        }