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")); }
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); }
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)); }
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); }
/// <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); }
/// <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); }
public RazorMailerEngineTests() { // Initialised per test by xunit _dispatcher = new Mock <IEmailDispatcher>(); _mailerEngine = new RazorMailerEngine("templates", "*****@*****.**", "SampleApp", _dispatcher.Object); }
/// <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); }