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 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(); }