Ejemplo n.º 1
0
        protected void TestInboxDeferred(string workQueueUriFormat, string errorQueueUriFormat)
        {
            var configuration = GetConfiguration(workQueueUriFormat, errorQueueUriFormat, 1, false);

            var module = new InboxDeferredModule();

            configuration.Modules.Add(module);

            Guid messageId;
            var messageType = typeof(ReceivePipelineCommand).FullName;

            using (var bus = new ServiceBus(configuration))
            {
                bus.Start();

                var transportMessage = bus.SendDeferred(DateTime.Now.AddMilliseconds(500), new ReceivePipelineCommand(),
                                                        configuration.Inbox.WorkQueue);
                var timeout = DateTime.Now.AddMilliseconds(1000);

                Assert.IsNotNull(transportMessage);

                messageId = transportMessage.MessageId;

                while (module.TransportMessage == null && DateTime.Now < timeout)
                {
                    Thread.Sleep(5);
                }
            }

            Assert.IsNotNull(module.TransportMessage);
            Assert.True(messageId.Equals(module.TransportMessage.MessageId));
            Assert.True(messageType.Equals(module.TransportMessage.MessageType, StringComparison.OrdinalIgnoreCase));
        }