public void HasAttributesAssignedCorrectly() { IProject project = new Project(); IntegrationRequest integrationRequest = new IntegrationRequest(BuildCondition.NoBuild, "Test", null); IIntegrationQueueNotifier integrationQueueNotifier = new TestIntegrationQueueCallback(); IIntegrationQueueItem integrationQueueItem = new IntegrationQueueItem(project, integrationRequest, integrationQueueNotifier); Assert.AreEqual(project, integrationQueueItem.Project); Assert.AreEqual(integrationRequest, integrationQueueItem.IntegrationRequest); Assert.AreEqual(integrationQueueNotifier, integrationQueueItem.IntegrationQueueNotifier); }
public void RemovePendingRequestOnly() { queueNotifier1Mock.Expect("NotifyEnteringIntegrationQueue"); queueNotifier1Mock.ExpectNoCall("NotifyExitingIntegrationQueue", typeof(bool)); integrationQueueUseFirst.Enqueue(integrationQueueItem1); // Second item is same project IIntegrationQueueItem secondQueueItem = new IntegrationQueueItem((IProject)project1Mock.MockInstance, integrationRequestForceBuild, (IIntegrationQueueNotifier)queueNotifier2Mock.MockInstance); queueNotifier2Mock.Expect("NotifyEnteringIntegrationQueue"); queueNotifier2Mock.Expect("NotifyExitingIntegrationQueue", true); integrationQueueUseFirst.Enqueue(secondQueueItem); IIntegrationQueueItem[] itemsOnQueue = integrationQueueUseFirst.GetQueuedIntegrations(); Assert.AreEqual(2, itemsOnQueue.Length); integrationQueueUseFirst.RemovePendingRequest((IProject)project1Mock.MockInstance); itemsOnQueue = integrationQueueUseFirst.GetQueuedIntegrations(); Assert.AreEqual(1, itemsOnQueue.Length); Assert.AreSame(integrationQueueItem1, itemsOnQueue[0]); VerifyAll(); }
public void RemoveProjectClearsOnlyItemsThatAreForThisProject() { queueNotifier1Mock.Expect("NotifyEnteringIntegrationQueue"); queueNotifier1Mock.Expect("NotifyExitingIntegrationQueue", false); integrationQueueUseFirst.Enqueue(integrationQueueItem1); // Second item is different project but same queue project2Mock.SetupResult("QueueName", TestQueueName); queueNotifier2Mock.Expect("NotifyEnteringIntegrationQueue"); queueNotifier2Mock.ExpectNoCall("NotifyExitingIntegrationQueue", typeof(bool)); integrationQueueUseFirst.Enqueue(integrationQueueItem2); // Third item is same project as the first. IIntegrationQueueItem thirdQueueItem = new IntegrationQueueItem((IProject)project1Mock.MockInstance, integrationRequestForceBuild, (IIntegrationQueueNotifier)queueNotifier3Mock.MockInstance); queueNotifier3Mock.Expect("NotifyEnteringIntegrationQueue"); queueNotifier3Mock.Expect("NotifyExitingIntegrationQueue", true); integrationQueueUseFirst.Enqueue(thirdQueueItem); integrationQueueUseFirst.RemoveProject((IProject)project1Mock.MockInstance); IIntegrationQueueItem[] itemsOnQueue = integrationQueueUseFirst.GetQueuedIntegrations(); Assert.AreEqual(1, itemsOnQueue.Length); Assert.AreSame(integrationQueueItem2, itemsOnQueue[0]); VerifyAll(); }
public void NoMoreThanOnePendingIntegrationForAProject() { // Setup the first request queueNotifier1Mock.Expect("NotifyEnteringIntegrationQueue"); queueNotifier1Mock.ExpectNoCall("NotifyExitingIntegrationQueue", typeof(bool)); integrationQueueUseFirst.Enqueue(integrationQueueItem1); // Add a second request for same project IIntegrationQueueItem secondQueueItem = new IntegrationQueueItem((IProject)project1Mock.MockInstance, integrationRequestForceBuild, (IIntegrationQueueNotifier)queueNotifier1Mock.MockInstance); queueNotifier1Mock.Expect("NotifyEnteringIntegrationQueue"); queueNotifier1Mock.ExpectNoCall("NotifyExitingIntegrationQueue", typeof(bool)); integrationQueueUseFirst.Enqueue(secondQueueItem); // Try to add a third request for same project IIntegrationQueueItem thirdQueueItem = new IntegrationQueueItem((IProject)project1Mock.MockInstance, integrationRequestForceBuild, (IIntegrationQueueNotifier)queueNotifier1Mock.MockInstance); queueNotifier1Mock.ExpectNoCall("NotifyEnteringIntegrationQueue"); queueNotifier1Mock.ExpectNoCall("NotifyExitingIntegrationQueue", typeof(bool)); integrationQueueUseFirst.Enqueue(thirdQueueItem); IIntegrationQueueItem[] itemsOnQueue = integrationQueueUseFirst.GetQueuedIntegrations(); Assert.AreEqual(2, itemsOnQueue.Length); Assert.AreSame(integrationQueueItem1, itemsOnQueue[0]); Assert.AreSame(secondQueueItem, itemsOnQueue[1]); VerifyAll(); }