public void ShouldReturnCurrentLabelAsLastSuccessfulIntegrationLabelIfSuccessful()
 {
     result.AddTaskResult(new ProcessTaskResult(ProcessResultFixture.CreateSuccessfulResult()));
     result.LastSuccessfulIntegrationLabel = "1";
     result.Label = "2";
     Assert.AreEqual("2", result.LastSuccessfulIntegrationLabel);
 }
 public void ShouldReturnPreviousLabelAsLastSuccessfulIntegrationLabelIfFailed()
 {
     result.AddTaskResult(new ProcessTaskResult(ProcessResultFixture.CreateNonZeroExitCodeResult()));
     result.LastSuccessfulIntegrationLabel = "1";
     result.Label = "2";
     Assert.AreEqual("1", result.LastSuccessfulIntegrationLabel);
 }
예제 #3
0
 protected ProcessResult TimedOutProcessResult()
 {
     return(ProcessResultFixture.CreateTimedOutResult());
 }
예제 #4
0
 protected ProcessResult SuccessfulProcessResult()
 {
     return(ProcessResultFixture.CreateSuccessfulResult(ProcessResultOutput));
 }
 public void ShouldHaveExceptionStatusIfExceptionHasBeenThrown()
 {
     result.ExceptionResult = new Exception("build blew up");
     result.AddTaskResult(new ProcessTaskResult(ProcessResultFixture.CreateSuccessfulResult()));
     Assert.AreEqual(IntegrationStatus.Exception, result.Status);
 }
 public void ShouldHaveFailedIfContainsFailedTaskResults()
 {
     result.AddTaskResult(new ProcessTaskResult(ProcessResultFixture.CreateNonZeroExitCodeResult()));
     result.AddTaskResult(new ProcessTaskResult(ProcessResultFixture.CreateSuccessfulResult()));
     Assert.IsTrue(result.Failed);
 }
 public void ShouldSucceedIfContainsOnlySuccessfulTaskResults()
 {
     result.AddTaskResult(new ProcessTaskResult(ProcessResultFixture.CreateSuccessfulResult()));
     Assert.IsTrue(result.Succeeded);
 }
예제 #8
0
        public void CloneShouldWork()
        {
            string workingDir  = Path.GetFullPath(Path.Combine(".", "workingdir"));
            string artifactDir = Path.GetFullPath(Path.Combine(".", "artifacts"));

            result = new IntegrationResult("project", workingDir, artifactDir,
                                           new IntegrationRequest(BuildCondition.IfModificationExists, "myTrigger", "John Doe"),
                                           new IntegrationSummary(IntegrationStatus.Failure, "label23", "label22",
                                                                  new DateTime(2005, 06, 06, 08, 45, 00)));
            result.StartTime  = new DateTime(2005, 06, 06, 08, 45, 00);
            result.ProjectUrl = "http://localhost/ccnet2";
            result.BuildId    = new Guid(IntegrationResultMother.DefaultBuildId);

            result.AddTaskResult(new ProcessTaskResult(ProcessResultFixture.CreateNonZeroExitCodeResult()));
            result.AddTaskResult(new ProcessTaskResult(ProcessResultFixture.CreateSuccessfulResult()));

            Modification mods = new Modification();

            mods.UserName        = "******";
            result.Modifications = new Modification[] { mods };


            var TheClone = result.Clone();


            Assert.AreEqual(result.IntegrationProperties.Count, TheClone.IntegrationProperties.Count);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetProject], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetProject]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetProjectUrl], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetProjectUrl]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetLabel], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetLabel]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetNumericLabel], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetNumericLabel]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetArtifactDirectory], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetArtifactDirectory]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetWorkingDirectory], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetWorkingDirectory]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetBuildCondition], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetBuildCondition]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetIntegrationStatus], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetIntegrationStatus]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetLastIntegrationStatus], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetLastIntegrationStatus]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetRequestSource], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetRequestSource]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetUser], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetUser]);
            Assert.AreEqual(result.IntegrationProperties[IntegrationPropertyNames.CCNetListenerFile], TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetListenerFile]);

            ArrayList failureUsers = TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetFailureUsers] as ArrayList;

            Assert.IsNotNull(failureUsers);
            ArrayList failureTasks = TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetFailureTasks] as ArrayList;

            Assert.IsNotNull(failureTasks);
            ArrayList Modifiers = TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetModifyingUsers] as ArrayList;

            Assert.IsNotNull(Modifiers);
            Assert.AreEqual(1, Modifiers.Count);
            Assert.AreEqual("John", Modifiers[0]);

            Assert.AreEqual(result.Status, TheClone.Status);

            //below are the ones that are not cloned, should these be cloned also, see bug 240
            //http://www.cruisecontrolnet.org/issues/240

            // We purposefully use culture-independent string formats
            //Assert.AreEqual("2005-06-06", TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetBuildDate]);
            //Assert.AreEqual(IntegrationResultMother.DefaultBuildId, TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetBuildId]);
            //Assert.AreEqual("08:45:00", TheClone.IntegrationProperties[IntegrationPropertyNames.CCNetBuildTime]);
            //Assert.AreEqual(1, failureUsers.Count);
            //Assert.AreEqual("user", failureUsers[0]);
            //Assert.AreEqual(1, failureTasks.Count);
            //Assert.AreEqual("task", failureTasks[0]);
        }