public void AskToIntegrateWillQueueSubsequentItems() { var queue = new Queue(); var project1 = new ProjectStub(); var project2 = new ProjectStub(); var context1 = new IntegrationContext(project1); var context2 = new IntegrationContext(project2); queue.AskToIntegrate(context1); queue.AskToIntegrate(context2); var active = queue.GetActiveRequests(); var pending = queue.GetPendingRequests(); Assert.AreEqual(1, active.Count()); Assert.AreEqual(1, pending.Count()); Assert.AreSame(active.First(), context1); Assert.AreSame(pending.First(), context2); }
public void CompletingAnIntegrationRemovesItFromActiveRequests() { var project = new ProjectStub(); var queue = new Queue(); var context = new IntegrationContext(project); queue.AskToIntegrate(context); context.Complete(); Assert.AreEqual(0, queue.GetActiveRequests().Count()); Assert.AreEqual(0, queue.GetPendingRequests().Count()); }
public void AskToIntegrateWillTriggerProjectIfFirst() { var project = new ProjectStub(); var queue = new Queue(); var context = new IntegrationContext(project); queue.AskToIntegrate(context); var canIntegrate = context.Wait(TimeSpan.FromSeconds(5)); Assert.IsTrue(canIntegrate); var active = queue.GetActiveRequests(); Assert.AreEqual(1, active.Count()); Assert.AreEqual(0, queue.GetPendingRequests().Count()); Assert.AreSame(active.First(), context); }
public void CompletingReleasingSubsequentItems() { var queue = new Queue(); var project1 = new ProjectStub(); var project2 = new ProjectStub(); var context1 = new IntegrationContext(project1); var context2 = new IntegrationContext(project2); queue.AskToIntegrate(context1); queue.AskToIntegrate(context2); context1.Complete(); var active = queue.GetActiveRequests(); Assert.AreEqual(1, active.Count()); Assert.AreEqual(0, queue.GetPendingRequests().Count()); Assert.AreSame(context2, active.First()); }