コード例 #1
0
 public void reduced_ctor_not_able_to_create_mailmessage()
 {
     _mailerEngine = new RazorMailerEngine("templates");
     Assert.Throws <MissingInformationException>(() => _mailerEngine.Create("WelcomePartial", new WelcomeModel {
         Name = "Joe Blogs"
     }, "*****@*****.**", "Welcome to our service"));
 }
コード例 #2
0
 public async Task null_dispatcher_async()
 {
     _mailerEngine = new RazorMailerEngine("templates", "*****@*****.**", "SampleApp", new NullDispatcher());
     var email = _mailerEngine.Create("WelcomePartial", new WelcomeModel {
         Name = "Joe Blogs"
     }, "*****@*****.**", "Welcome to our service");
     await _mailerEngine.SendAsync(email);
 }
コード例 #3
0
 public async Task implicit_ctor_smtp_host_not_provided()
 {
     _mailerEngine = new RazorMailerEngine("templates", "*****@*****.**", "SampleApp");
     var email = _mailerEngine.Create("WelcomePartial", new WelcomeModel {
         Name = "Joe Blogs"
     }, "*****@*****.**", "Welcome to our service");
     await Assert.ThrowsAsync <InvalidOperationException>(() => _mailerEngine.SendAsync(email));
 }
コード例 #4
0
        public void reduced_ctor_able_to_create_string()
        {
            _mailerEngine = new RazorMailerEngine("templates");
            var text = _mailerEngine.Create("WelcomePartial", new WelcomeModel {
                Name = "Joe Blogs"
            });

            Assert.Contains("Joe Blogs", text);
        }
コード例 #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultMailer"/> class.
        /// </summary>
        /// <param name="dispatcher">
        /// The dispatcher.
        /// </param>
        public DefaultMailer(IEmailDispatcher dispatcher)
        {
            var container = DependencyResolver.Current.GetService <IContainer>();

            config     = container.GetInstance <IConfigService>();
            jobManager = container.GetInstance <IJobManager>();

            mailerEngine = new RazorMailerEngine(
                @"Views\EmailTemplates",
                config.DefaultEmailAddress,
                config.DefaultEmailName,
                dispatcher);
        }
コード例 #6
0
 /// <summary>
 /// This overload allows us to pass in a mock dispatcher for testing purposes
 /// </summary>
 public AlarmesEquipamentosMailer(IEmailDispatcher dispatcher)
 {
     // Default to the built in Smtp engine
     _mailerEngine = new RazorMailerEngine(@"email\templates", "*****@*****.**", "Alarmes e Equipamentos", dispatcher);
 }
コード例 #7
0
 public RazorMailerEngineTests()
 {
     // Initialised per test by xunit
     _dispatcher   = new Mock <IEmailDispatcher>();
     _mailerEngine = new RazorMailerEngine("templates", "*****@*****.**", "SampleApp", _dispatcher.Object);
 }
コード例 #8
0
 /// <summary>
 /// This overload allows us to pass in a mock dispatcher for testing purposes
 /// </summary>
 public Mailer(IEmailDispatcher dispatcher)
 {
     // Default to the built in Smtp engine
     _mailerEngine = new RazorMailerEngine(@"email\templates", "*****@*****.**", "Sample Website", dispatcher);
 }