public void ShouldDeleteTemporaryLabelIfIntegrationFailed() { mockProcessExecutor.ExpectAndReturn("Execute", SuccessfulProcessResult(), new IsAnything()); ExpectToExecuteArguments("label $/fooProject -L -VLCCNETUNVERIFIED06102005182431 \"-YJoe Admin,admin\" -I-Y"); IntegrationResult result = IntegrationResultMother.CreateFailed("foo"); result.StartTime = new DateTime(2005, 6, 10, 18, 24, 31); vss.ApplyLabel = true; vss.AutoGetSource = false; vss.GetSource(result); vss.LabelSourceControl(result); }
public void ShouldSendMessageIfBuildFailed() { mockGateway.Setup(gateway => gateway.Send(It.IsAny <MailMessage>())). Callback <MailMessage>(message => { Assert.AreEqual(1, message.To.Count); }).Verifiable(); publisher = new EmailPublisher(); publisher.FromAddress = "*****@*****.**"; publisher.EmailGateway = (EmailGateway)mockGateway.Object; publisher.IndexedEmailUsers.Add("bar", new EmailUser("bar", "foo", "*****@*****.**")); publisher.IndexedEmailGroups.Add("foo", new EmailGroup("foo", new EmailGroup.NotificationType[] { EmailGroup.NotificationType.Failed })); publisher.Run(IntegrationResultMother.CreateFailed()); mockGateway.Verify(); }
public void CreateWorkingDirectoryIfItDoesNotExist() { string workingDirectory = TempFileUtil.GetTempPath("VSS"); TempFileUtil.DeleteTempDir(workingDirectory); Assert.IsFalse(Directory.Exists(workingDirectory)); ExpectToExecuteAndReturn(SuccessfulProcessResult()); vss.AutoGetSource = true; vss.WorkingDirectory = workingDirectory; vss.GetSource(IntegrationResultMother.CreateFailed()); Assert.IsTrue(Directory.Exists(workingDirectory)); TempFileUtil.DeleteTempDir(workingDirectory); }
public virtual void ShouldNotDeleteLabelIfItWasNeverApplied() { vault.ApplyLabel = true; vault.UseVaultWorkingDirectory = false; vault.WorkingDirectory = DefaultWorkingDirectory; vault.AutoGetSource = true; vault.Folder = "$"; IntegrationResult failed = IntegrationResultMother.CreateFailed(); failed.Label = result.Label; failed.WorkingDirectory = result.WorkingDirectory; vault.LabelSourceControl(failed); mockProcessExecutor.VerifyNoOtherCalls(); VerifyAll(); }
public virtual void ShouldNotDeleteLabelIfItWasNeverApplied() { this.ExpectThatExecuteWillNotBeCalled(); vault.ApplyLabel = true; vault.UseVaultWorkingDirectory = false; vault.WorkingDirectory = DefaultWorkingDirectory; vault.AutoGetSource = true; vault.Folder = "$"; IntegrationResult failed = IntegrationResultMother.CreateFailed(); failed.Label = result.Label; failed.WorkingDirectory = result.WorkingDirectory; vault.LabelSourceControl(failed); VerifyAll(); }
public void ShouldSendMessageIfBuildFailedAndPreviousOK() { mockGateway.Expect("Send", new MailMessageRecipientValidator(2)); publisher = new EmailPublisher(); publisher.FromAddress = "*****@*****.**"; publisher.EmailGateway = (EmailGateway)mockGateway.MockInstance; publisher.IndexedEmailUsers.Add("dev", new EmailUser("dev", "changing", "*****@*****.**")); publisher.IndexedEmailUsers.Add("admin", new EmailUser("admin", "failing", "*****@*****.**")); publisher.IndexedEmailGroups.Add("changing", new EmailGroup("changing", new EmailGroup.NotificationType[] { EmailGroup.NotificationType.Change })); publisher.IndexedEmailGroups.Add("failing", new EmailGroup("failing", new EmailGroup.NotificationType[] { EmailGroup.NotificationType.Failed })); publisher.Run(IntegrationResultMother.CreateFailed(IntegrationStatus.Success)); mockGateway.Verify(); }
public virtual void ShouldSetAndRemoveLabelOnFailure() { ExpectToExecuteArguments(@"label $ foo"); ExpectToExecuteArguments(@"getlabel $ foo -destpath " + StringUtil.AutoDoubleQuoteString(DefaultWorkingDirectory) + " -merge overwrite -makewritable -setfiletime checkin"); ExpectToExecuteArguments(@"deletelabel $ foo"); vault.ApplyLabel = true; vault.UseVaultWorkingDirectory = false; vault.WorkingDirectory = DefaultWorkingDirectory; vault.AutoGetSource = true; vault.Folder = "$"; vault.GetSource(result); IntegrationResult failed = IntegrationResultMother.CreateFailed(); failed.Label = result.Label; failed.WorkingDirectory = result.WorkingDirectory; vault.LabelSourceControl(failed); VerifyAll(); }
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 ShouldNotCopyFilesIfBuildBrokenAndAlwaysCopyIsSetToFalse() { SystemPath subRoot = srcRoot.CreateSubDirectory("SubDir"); SystemPath subSubRoot = subRoot.CreateSubDirectory("SubSubDir"); srcRoot.CreateTextFile(fileName, fileContents); subRoot.CreateTextFile(fileName, fileContents); subSubRoot.CreateTextFile(fileName, fileContents); result = IntegrationResultMother.CreateFailed("99"); publisher.Run(result); Assert.IsFalse(labelPubDir.Combine(fileName).Exists(), "File found in build number directory"); SystemPath subPubDir = labelPubDir.Combine("SubDir"); Assert.IsFalse(subPubDir.Combine(fileName).Exists(), "File found in sub directory"); Assert.IsFalse(subPubDir.Combine("SubSubDir").Combine(fileName).Exists(), "File found in sub sub directory"); }
public void ShouldSendMessageIfBuildFailedAndPreviousOK() { 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.IndexedEmailUsers.Add("dev", new EmailUser("dev", "changing", "*****@*****.**")); publisher.IndexedEmailUsers.Add("admin", new EmailUser("admin", "failing", "*****@*****.**")); publisher.IndexedEmailGroups.Add("changing", new EmailGroup("changing", new EmailGroup.NotificationType[] { EmailGroup.NotificationType.Change })); publisher.IndexedEmailGroups.Add("failing", new EmailGroup("failing", new EmailGroup.NotificationType[] { EmailGroup.NotificationType.Failed })); publisher.Run(IntegrationResultMother.CreateFailed(IntegrationStatus.Success)); mockGateway.Verify(); }
public void ShouldNotApplyLabelIfIntegrationFailed() { ExpectThatExecuteWillNotBeCalled(); svn.TagOnSuccess = true; svn.LabelSourceControl(IntegrationResultMother.CreateFailed()); }
public void VerifyRecipientListForFailedBuild() { IIntegrationResult result = AddModification(IntegrationResultMother.CreateFailed()); Assert.AreEqual(ExpectedRecipients(always, changed, failed, modifier), new EmailMessage(result, publisher).Recipients); }
public void EmailSubjectForFailedBuild() { string subject = GetEmailMessage(IntegrationResultMother.CreateFailed(), true).Subject; Assert.AreEqual("CCNET: Project#9 Build Failed", subject); }
public void ShouldNotApplyLabelIfIntegrationFailed() { svn.TagOnSuccess = true; svn.LabelSourceControl(IntegrationResultMother.CreateFailed()); mockProcessExecutor.VerifyNoOtherCalls(); }