Ejemplo n.º 1
0
        public IMailNotifier Build()
        {
            var notifier = new MailNotifier(
                _fromAddress,
                _outgoingQueue,
                _mailingListBroker,
                _templateEngine,
                _emailSenders);

            return notifier;
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            _sender = new TestEmailSender();
            var outgouingQueue = new TransientQueue();
            var mailingListBroker = new TestMailingListBroker().Register<string>("*****@*****.**", "*****@*****.**");
            var templateEngine = new MailTemplateEngine();
            templateEngine.Register<string>(m => new MailView(string.Format("Subject for {0}", m),
                                                               string.Format("Body for {0}!", m)));

            _notifier = new MailNotifier("*****@*****.**", outgouingQueue, mailingListBroker, templateEngine, _sender);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        public IConsumer GetConsumer(ConsumerType type, MailSettings settings = null)
        {
            switch (type)
            {
            case ConsumerType.OrderConsumer:
            {
                var notifier = new MailNotifier(settings);

                return((IConsumer) new OrderMessageConsumer(_channel, notifier));
            }

            case ConsumerType.NotificationConsumer:
                return((IConsumer) new NotificationMessageConsumer(_channel, new SmsNotifier()));

            default:
                throw new NotSupportedException();
            }
        }