Provides a class used to handle email.
Inheritance: System.Configuration.Provider.ProviderBase
示例#1
0
 public EmailService(EmailProvider provider, ITemplateEngine templateEngine, ISubtextContext context)
 {
     EmailProvider = provider;
     TemplateEngine = templateEngine;
     Url = context.UrlHelper;
     Blog = context.Blog;
     Context = context;
 }
        public void Initialize_WithNullPort_UsesDefaultPort(EmailProvider provider)
        {
            // arrange
            var configValue = new NameValueCollection();
            configValue["port"] = null;

            // act
            provider.Initialize("providerTest", configValue);

            // assert
            Assert.AreEqual(25, provider.Port);
        }
        public void CanInstantiateAndInitializeEmailProvider(EmailProvider provider)
        {
            Assert.IsNotNull(provider, "Well the provider should not be null.");
            NameValueCollection configValue = new NameValueCollection();
            configValue["adminEmail"] = "*****@*****.**";
            configValue["smtpServer"] = "smtp.example.com";
            configValue["password"] = "******";;
            configValue["username"] = "******";
            provider.Initialize("providerTest", configValue);

            Assert.AreEqual("*****@*****.**", provider.AdminEmail, "Did not initialize the admin email properly.");
            Assert.AreEqual("smtp.example.com", provider.SmtpServer, "Did not initialize the SMTP server properly.");
            Assert.AreEqual("abracadabra", provider.Password, "Did not initialize the password properly.");
            Assert.AreEqual("haacked", provider.UserName, "Did not initialize the username properly.");
        }
        public void Initialize_WithValuesFromConfig_SetsConfigProperties(EmailProvider provider)
        {
            // arrange
            var configValue = new NameValueCollection();
            configValue["adminEmail"] = "*****@*****.**";
            configValue["smtpServer"] = "smtp.example.com";
            configValue["password"] = "******";
            configValue["username"] = "******";

            // act
            provider.Initialize("providerTest", configValue);

            // assert
            Assert.AreEqual("*****@*****.**", provider.AdminEmail, "Did not initialize the admin email properly.");
            Assert.AreEqual("smtp.example.com", provider.SmtpServer, "Did not initialize the SMTP server properly.");
            Assert.AreEqual("abracadabra", provider.Password, "Did not initialize the password properly.");
            Assert.AreEqual("haacked", provider.UserName, "Did not initialize the username properly.");
        }
示例#5
0
 public void SetInternalProvider(EmailProvider provider)
 {
     internalProvider = provider;
 }