public void RunASingleActionOnSingleProject() { // Initialise the test var task = new CruiseServerControlTask(); task.Logger = this.logger; task.ClientFactory = this.factory; MockSequence sequence = new MockSequence(); this.InitialiseStandardBuildInfo(sequence); this.InitialiseClient(sequence, "tcp://localhost:21234", "Test", "Dummy"); this.InitialiseActionEvents(sequence, "Dummy", "Performing start project action", CruiseServerControlTaskActionType.StartProject, "Dummy"); this.InitialiseTermination(sequence, 1); // Add the action task.Actions = new CruiseServerControlTaskAction[] { new CruiseServerControlTaskAction { Project = "Dummy", Type = CruiseServerControlTaskActionType.StartProject } }; // Run the test task.Run(result); // Verify the results Assert.AreEqual(IntegrationStatus.Success, result.Status); this.mocks.VerifyAll(); }
public void RunMultipleCommands() { // 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", "Test1", "Dummy", "Test2"); this.InitialiseActionEvents( "Test?", "Performing start project action", p => { this.client.StartProject(p); }, "Test1", "Test2"); this.InitialiseActionEvents( "Dummy", "Performing stop project action", p => { this.client.StopProject(p); }, "Dummy"); this.InitialiseTermination(3); } // Add the action task.Actions = new CruiseServerControlTaskAction[] { new CruiseServerControlTaskAction { Project = "Test?", Type = CruiseServerControlTaskActionType.StartProject }, new CruiseServerControlTaskAction { Project = "Dummy", Type = CruiseServerControlTaskActionType.StopProject } }; // Run the test this.mocks.ReplayAll(); task.Run(result); // Verify the results Assert.AreEqual(IntegrationStatus.Success, result.Status); this.mocks.VerifyAll(); }
public void ValidateGeneratesWarningWithNoTasks() { var task = new CruiseServerControlTask(); task.Actions = new CruiseServerControlTaskAction[0]; var processor = this.mocks.Create <IConfigurationErrorProcesser>(MockBehavior.Strict).Object; Mock.Get(processor).Setup(_processor => _processor.ProcessWarning("This task will not do anything - no actions specified")).Verifiable(); task.Validate(null, null, processor); this.mocks.Verify(); }
public void ValidateGeneratesWarningWithNoTasks() { var task = new CruiseServerControlTask(); task.Actions = new CruiseServerControlTaskAction[0]; 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(); }
public void ValidateHandlesValidConfig() { var task = new CruiseServerControlTask(); task.Actions = new CruiseServerControlTaskAction[] { new CruiseServerControlTaskAction { Project = "*", Type = CruiseServerControlTaskActionType.StopProject } }; var processor = this.mocks.Create <IConfigurationErrorProcesser>(MockBehavior.Strict).Object; task.Validate(null, null, processor); this.mocks.Verify(); }
public void RunHandlesNoActions() { // Initialise the test var task = new CruiseServerControlTask(); task.Logger = this.logger; task.ClientFactory = this.factory; MockSequence sequence = new MockSequence(); this.InitialiseStandardBuildInfo(sequence); this.InitialiseClient(sequence, "tcp://localhost:21234", "Test", "Dummy"); this.InitialiseTermination(sequence, 0); // Run the test task.Run(result); // Verify the results Assert.AreEqual(IntegrationStatus.Success, result.Status); this.mocks.VerifyAll(); }