Example #1
0
            public void WillEmptyProcessingQueueBeforeProcessingPendingMessages()
            {
                testQueue.SendMessage("Message #1");
                testQueue.Move(testQueue.SendMessage("Message #2"), processingQueue);

                using (new MessageReceiver <String>(TestMessageQueue.Path, new BinarySerializer(), messageProcessor))
                    messageProcessor.ProcessMessages(count: 2);

                Assert.Equal("Message #2", messageProcessor.Messages.First().Payload);
                Assert.Equal("Message #1", messageProcessor.Messages.Last().Payload);
            }
Example #2
0
            public void WillMoveMessageToPoisonQueueIfUnableToDeserializeMessage()
            {
                var message = new System.Messaging.Message("Invalid Message")
                {
                    Recoverable = true
                };

                testQueue.Send(message);

                using (new MessageReceiver <String>(TestMessageQueue.Path, new BinarySerializer(), messageProcessor))
                {
                    testQueue.SendMessage("Valid Message");
                    messageProcessor.ProcessMessages(count: 1);
                }

                using (var poisonQueue = TestMessageQueue.Create("poison"))
                    Assert.NotNull(poisonQueue.PeekById(message.Id));
            }