protected override bool Execute(IIntegrationResult result)
        {
            if (result.Status == IntegrationStatus.Unknown) return false;

            result.BuildProgressInformation.SignalStartRunTask(!string.IsNullOrEmpty(Description) ? Description : "Emailing ...");

            EmailMessage emailMessage = new EmailMessage(result, this);
            string to = emailMessage.Recipients;
            string subject = emailMessage.Subject;
            string message = CreateMessage(result);
            if (IsRecipientSpecified(to))
            {
                Log.Info(string.Format("Emailing \"{0}\" to {1}", subject, to));
                SendMessage(fromAddress, to, replytoAddress, subject, message, result.WorkingDirectory);
            }

            return true;
        }
        public void EmailSubjectForStillBrokenBuild_DefaultMessage()
        {
            EmailPublisher publisher = EmailPublisherMother.Create();
            publisher.SubjectSettings = new System.Collections.Hashtable();

            IntegrationResult result = IntegrationResultMother.CreateFailed(ThoughtWorks.CruiseControl.Remote.IntegrationStatus.Failure);

            string subject = new EmailMessage(DecorateIntegrationResult(result), publisher).Subject;
            Assert.AreEqual("CCNET: Project#9 is still broken", subject);
        }
        public void ShouldConvertUsernamesToEmailAddresses()
        {
            EmailPublisher myPublisher = new EmailPublisher();

            myPublisher.Converters = new IEmailConverter[1];
            myPublisher.Converters[0] = new EmailRegexConverter("^([^@]*)$", @"[email protected]");

            IIntegrationResult result = IntegrationResultMother.CreateFailed();
            Modification modification = new Modification();
            modification.UserName = "******";
            result.Modifications = new Modification[1] { modification };

            EmailMessage message = new EmailMessage(result, myPublisher);
            Assert.AreEqual("*****@*****.**", message.Recipients);
        }
 public void CreateRecipientListWithNoRecipients()
 {
     EmailMessage emailMessage = new EmailMessage(IntegrationResultMother.CreateFixed(), new EmailPublisher());
     Assert.AreEqual(string.Empty, emailMessage.Recipients);
 }
Beispiel #5
0
        public void Run(IIntegrationResult result)
        {
            if (result.Status == IntegrationStatus.Unknown)
                return;

            result.AddIntegrationProperty("CCNetDashboardServerName", this.DashboardServerName);
            EmailMessage  emailMessage = new EmailMessage(result, this);
            string to = emailMessage.Recipients;
            string subject = emailMessage.Subject;
            string message = CreateMessage(result);
            if (IsRecipientSpecified(to))
            {
                SendMessage(fromAddress, to, subject, message);
            }
        }