public void RunHandlesNoActions()
        {
            // Initialise the test
            var task = new CruiseServerControlTask();
            task.Logger = this.logger;
            task.ClientFactory = this.factory;
            using (mocks.Ordered())
            {
                this.InitialiseStandardBuildInfo();
                this.InitialiseClient("tcp://localhost:21234", "Test", "Dummy");
                this.InitialiseTermination(0);
            }

            // Run the test
            this.mocks.ReplayAll();
            task.Run(result);

            // Verify the results
            Assert.AreEqual(IntegrationStatus.Success, result.Status);
            this.mocks.VerifyAll();
        }
        public void RunASingleActionOnMultipleProjects()
        {
            // Initialise the test
            var task = new CruiseServerControlTask();
            task.Logger = this.logger;
            task.ClientFactory = this.factory;
            using (mocks.Ordered())
            {
                this.InitialiseStandardBuildInfo();
                this.InitialiseClient("tcp://localhost:21234", "Test", "Dummy");
                this.InitialiseActionEvents(
                    "*",
                    "Performing start project action",
                    p =>
                    {
                        this.client.StartProject(p);
                    },
                    "Test",
                    "Dummy");
                this.InitialiseTermination(2);
            }

            // Add the action
            task.Actions = new CruiseServerControlTaskAction[]
            {
                new CruiseServerControlTaskAction
                {
                    Project = "*",
                    Type = CruiseServerControlTaskActionType.StartProject
                }
            };

            // Run the test
            this.mocks.ReplayAll();
            task.Run(result);

            // Verify the results
            Assert.AreEqual(IntegrationStatus.Success, result.Status);
            this.mocks.VerifyAll();
        }
 public void ValidateHandlesValidConfig()
 {
     var task = new CruiseServerControlTask();
     task.Actions = new CruiseServerControlTaskAction[]
     {
         new CruiseServerControlTaskAction
         {
             Project = "*",
             Type = CruiseServerControlTaskActionType.StopProject
         }
     };
     var processor = this.mocks.StrictMock<IConfigurationErrorProcesser>();
     this.mocks.ReplayAll();
     task.Validate(null, null, processor);
     this.mocks.VerifyAll();
 }
 public void ValidateGeneratesWarningWithNullTasks()
 {
     var task = new CruiseServerControlTask();
     task.Actions = null;
     var processor = this.mocks.StrictMock<IConfigurationErrorProcesser>();
     Expect.Call(() =>
     {
         processor.ProcessWarning("This task will not do anything - no actions specified");
     });
     this.mocks.ReplayAll();
     task.Validate(null, null, processor);
     this.mocks.VerifyAll();
 }