public void ShouldSendFixedMailToFailureUsersWithModificationNotificationSetToFailedAndFixed()
        {
            mockGateway.Expect("Send", new MailMessageRecipientValidator(2));

            publisher              = new EmailPublisher();
            publisher.FromAddress  = "*****@*****.**";
            publisher.EmailGateway = (EmailGateway)mockGateway.MockInstance;
            publisher.ModifierNotificationTypes    = new EmailGroup.NotificationType[2];
            publisher.ModifierNotificationTypes[0] = EmailGroup.NotificationType.Failed;
            publisher.ModifierNotificationTypes[1] = EmailGroup.NotificationType.Fixed;

            publisher.IndexedEmailUsers.Add("user1", new EmailUser("user1", null, "*****@*****.**"));
            publisher.IndexedEmailUsers.Add("user2", new EmailUser("user2", null, "*****@*****.**"));

            IntegrationResult result;
            Modification      modification;

            result = IntegrationResultMother.CreateFixed();
            result.FailureUsers.Add("user1");

            modification              = new Modification();
            modification.UserName     = "******";
            modification.ModifiedTime = new DateTime(1973, 12, 24, 2, 30, 00);
            result.Modifications      = new Modification[] { modification };

            publisher.Run(result);
            mockGateway.Verify();
        }
Ejemplo n.º 2
0
        public void ShouldSendFixedMailToFailureUsersWithModificationNotificationSetToFailedAndFixed()
        {
            mockGateway.Setup(gateway => gateway.Send(It.IsAny <MailMessage>())).
            Callback <MailMessage>(message => {
                Assert.AreEqual(2, message.To.Count);
            }).Verifiable();

            publisher              = new EmailPublisher();
            publisher.FromAddress  = "*****@*****.**";
            publisher.EmailGateway = (EmailGateway)mockGateway.Object;
            publisher.ModifierNotificationTypes    = new EmailGroup.NotificationType[2];
            publisher.ModifierNotificationTypes[0] = EmailGroup.NotificationType.Failed;
            publisher.ModifierNotificationTypes[1] = EmailGroup.NotificationType.Fixed;

            publisher.IndexedEmailUsers.Add("user1", new EmailUser("user1", null, "*****@*****.**"));
            publisher.IndexedEmailUsers.Add("user2", new EmailUser("user2", null, "*****@*****.**"));

            IntegrationResult result;
            Modification      modification;

            result = IntegrationResultMother.CreateFixed();
            result.FailureUsers.Add("user1");

            modification              = new Modification();
            modification.UserName     = "******";
            modification.ModifiedTime = new DateTime(1973, 12, 24, 2, 30, 00);
            result.Modifications      = new Modification[] { modification };

            publisher.Run(result);
            mockGateway.Verify();
        }
Ejemplo n.º 3
0
        public void CreateRecipientListWithNoRecipients()
        {
            EmailMessage emailMessage = new EmailMessage(IntegrationResultMother.CreateFixed(), new EmailPublisher());

            Assert.AreEqual(string.Empty, emailMessage.Recipients);
        }
Ejemplo n.º 4
0
        public void VerifyRecipientListForFixedBuild()
        {
            IIntegrationResult result = AddModification(IntegrationResultMother.CreateFixed());

            Assert.AreEqual(ExpectedRecipients(always, changed, modifier, success), new EmailMessage(result, publisher).Recipients);
        }
Ejemplo n.º 5
0
        public void EmailSubjectForFixedBuild()
        {
            string subject = GetEmailMessage(IntegrationResultMother.CreateFixed(), true).Subject;

            Assert.AreEqual("CCNET: Project#9 Build Fixed: Build 0", subject);
        }