Inheritance: IQueue, IDisposable
        public void Queue_should_be_persistent()
        {
            string name = Guid.NewGuid().ToString("N");

            using (var original = new PersistentQueue(name))
            {
                original.Enqueue("abc");
                original.Enqueue(12);
                original.Enqueue(true);
            }

            object item;
            using (var restored = new PersistentQueue(name))
            {
                Assert.That(restored.TryDequeue(out item), Is.True);
                Assert.That(item, Is.EqualTo("abc"));

                Assert.That(restored.TryDequeue(out item), Is.True);
                Assert.That(item, Is.EqualTo(12));
            }

            using (var restored = new PersistentQueue(name))
            {
                Assert.That(restored.TryDequeue(out item), Is.True);
                Assert.That(item, Is.EqualTo(true));
            }

            using (var restored = new PersistentQueue(name))
            {
                Assert.That(restored.TryDequeue(out item), Is.False);
                Assert.That(item, Is.Null);
            }
        }
Esempio n. 2
0
        public void Setup()
        {
            _sender = new TestEmailSender();
            var outgouingQueue = new PersistentQueue(Guid.NewGuid().ToString("n"));
            var mailingListBroker = new MailingListBroker(new[]
            {
                new MailingRule("*", new MailingList("alice@localhost"))
            });
            var templateEngine = new RazorMailTemplateEngine(new RazorTemplatesFactory("Resources"), true);

            _notifier = new MailNotifier(
                "me@localhost",
                outgouingQueue,
                mailingListBroker,
                templateEngine,
                _sender);
        }