public void ForceBuild() { integrationTriggerMock.ExpectNoCall("Fire"); projectMock.Expect("Integrate", new HasForceBuildCondition()); projectMock.Expect("NotifyPendingState"); projectMock.ExpectAndSignal("NotifySleepingState"); projectMock.ExpectNoCall("Integrate", typeof(IntegrationRequest)); projectMock.SetupResult("MaxSourceControlRetries", 5); projectMock.SetupResult("SourceControlErrorHandling", ThoughtWorks.CruiseControl.Core.Sourcecontrol.Common.SourceControlErrorHandlingPolicy.ReportEveryFailure); integrator.Start(); integrationTriggerMock.ExpectAndSignal("IntegrationCompleted"); var parameters = new Dictionary <string, string>(); integrator.ForceBuild("BuildForcer", parameters); integrationTriggerMock.WaitForSignal(); projectMock.WaitForSignal(); VerifyAll(); }
public void VerifyStateAfterException() { string exceptionMessage = "Intentional exception"; integrationTriggerMock.ExpectAndReturn("Fire", ForceBuildRequest()); projectMock.Expect("NotifyPendingState"); projectMock.ExpectAndThrow("Integrate", new CruiseControlException(exceptionMessage), new HasForceBuildCondition()); projectMock.ExpectAndSignal("NotifySleepingState"); projectMock.SetupResult("MaxSourceControlRetries", 5); projectMock.SetupResult("SourceControlErrorHandling", ThoughtWorks.CruiseControl.Core.Sourcecontrol.Common.SourceControlErrorHandlingPolicy.ReportEveryFailure); integrationTriggerMock.Expect("IntegrationCompleted"); integrator.Start(); projectMock.WaitForSignal(); Assert.AreEqual(ProjectIntegratorState.Running, integrator.State); integrator.Stop(false); integrator.WaitForExit(); Assert.AreEqual(ProjectIntegratorState.Stopped, integrator.State); VerifyAll(); }