/// <summary>
        /// Equalses the specified o.
        /// </summary>
        /// <param name="o">The o.</param>
        /// <returns></returns>
        /// <remarks></remarks>
        public override bool Equals(Object o)
        {
            if (o == null || o.GetType() != GetType())
            {
                return(false);
            }
            EmailGroup g = (EmailGroup)o;

            return(Name == g.Name);
        }
示例#2
0
        public override bool Equals(Object o)
        {
            if (o == null || o.GetType() != this.GetType())
            {
                return(false);
            }
            EmailGroup g = (EmailGroup)o;

            return(Name == g.Name && Notification == g.Notification);
        }
示例#3
0
        private EmailGroup GetEmailGroup(string groupname)
        {
            EmailGroup group = null;

            if (groupname != null)
            {
                emailPublisher.IndexedEmailGroups.TryGetValue(groupname, out group);
            }

            return(group);
        }
示例#4
0
 private void AddRecipients(IDictionary recipients, EmailGroup.NotificationType notificationType)
 {
     foreach (EmailUser user in emailPublisher.EmailUsers)
     {
         EmailGroup group = GetEmailGroup(user.Group);
         if (group != null && group.HasNotification(notificationType))
         {
             recipients[user.Address] = user;
         }
     }
 }
        public void PopulateFromConfiguration()
        {
            publisher = EmailPublisherMother.Create();

            Assert.AreEqual("smtp.telus.net", publisher.MailHost);
            Assert.AreEqual(26, publisher.MailPort);
            Assert.AreEqual("mailuser", publisher.MailhostUsername);
            Assert.IsNotNull(publisher.MailhostPassword);
            Assert.AreEqual("mailpassword", publisher.MailhostPassword.PrivateValue);
            Assert.AreEqual("*****@*****.**", publisher.FromAddress);
            Assert.AreEqual(2, publisher.ModifierNotificationTypes.Length);
            Assert.AreEqual(EmailGroup.NotificationType.Failed, publisher.ModifierNotificationTypes[0]);
            Assert.AreEqual(EmailGroup.NotificationType.Fixed, publisher.ModifierNotificationTypes[1]);

            Assert.AreEqual(1, publisher.Converters.Length);
            Assert.AreEqual("$", ((EmailRegexConverter) publisher.Converters[0]).Find);
            Assert.AreEqual("@TheCompany.com", ((EmailRegexConverter) publisher.Converters[0]).Replace);

            Assert.AreEqual(6, publisher.EmailUsers.Count);
            ArrayList expected = new ArrayList();
            expected.Add(new EmailUser("buildmaster", "buildmaster", "*****@*****.**"));
            expected.Add(new EmailUser("orogers", "developers", "*****@*****.**"));
            expected.Add(new EmailUser("manders", "developers", "*****@*****.**"));
            expected.Add(new EmailUser("dmercier", "developers", "*****@*****.**"));
            expected.Add(new EmailUser("rwan", "developers", "*****@*****.**"));
            expected.Add(new EmailUser("owjones", "successdudes", "*****@*****.**"));
            for (int i = 0; i < expected.Count; i++)
            {
                Assert.IsTrue(publisher.EmailUsers.ContainsValue(expected[i]));
            }

            Assert.AreEqual(3, publisher.EmailGroups.Count);
            EmailGroup developers = new EmailGroup("developers", new EmailGroup.NotificationType[] { EmailGroup.NotificationType.Change });
            EmailGroup buildmaster = new EmailGroup("buildmaster", new EmailGroup.NotificationType[] { EmailGroup.NotificationType.Always });
            EmailGroup successdudes = new EmailGroup("successdudes", new EmailGroup.NotificationType[] { EmailGroup.NotificationType.Success });
            Assert.AreEqual(developers, publisher.EmailGroups["developers"]);
            Assert.AreEqual(buildmaster, publisher.EmailGroups["buildmaster"]);
            Assert.AreEqual(successdudes, publisher.EmailGroups["successdudes"]);
        }
示例#6
0
 private void AddRecipients(IDictionary recipients, EmailGroup.NotificationType notificationType)
 {
     foreach (EmailUser user in emailPublisher.EmailUsers.Values)
     {
         EmailGroup group = GetEmailGroup(user.Group);
         if (group != null && group.HasNotification(notificationType))
         {
             recipients[user.Address] = user;
         }
     }
 }