public ServiceBusConfiguration CreateMemoryConfiguration() { MemoryQueue.Clear(); return(new ServiceBusConfiguration { Inbox = new InboxQueueConfiguration { WorkQueue = CreateMemoryInboxWork(), JournalQueue = CreateMemoryInboxJournal(), ErrorQueue = CreateMemoryInboxError(), DurationToSleepWhenIdle = new[] { TimeSpan.FromMilliseconds(5) }, ThreadCount = 1 }, ControlInbox = new ControlInboxQueueConfiguration { WorkQueue = CreateMemoryControlInboxWork(), JournalQueue = CreateMemoryControlInboxJournal(), ErrorQueue = CreateMemoryControlInboxError(), DurationToSleepWhenIdle = new[] { TimeSpan.FromMilliseconds(5) }, ThreadCount = 1 }, //Outbox = // new OutboxQueueConfiguration // { // WorkQueue = CreateMemoryOutboxWork(), // ErrorQueue = CreateMemoryOutboxError(), // DurationToSleepWhenIdle = new[] { TimeSpan.FromMilliseconds(5) }, // ThreadCount = 1 // }, Serializer = new DefaultSerializer(), MessageHandlerFactory = new DefaultMessageHandlerFactory(), PipelineFactory = new DefaultPipelineFactory(), TransactionScopeFactory = new DefaultServiceBusTransactionScopeFactory(), ThreadActivityFactory = new DefaultThreadActivityFactory() }); }
public void ShouldClear() { int expected = 0; MemoryQueue<MyTestObject> queue = new MemoryQueue<MyTestObject>(); queue.Enqueue(new MyTestObject()); Assert.AreEqual(1, queue.Count); queue.Clear(); Assert.AreEqual(expected, queue.Count); }