public void process_executes_the_task_at_stage_zero()
            {
                _q.Process();

                Assert.That(_t1.Executed);
                Assert.AreEqual(0, _t1.ExecutedOnStage);
            }
            public void process_executes_the_task_up_to_stage_one()
            {
                _q.Process();

                Assert.That(_t1.Executed);
                Assert.AreEqual(1, _t1.ExecutedOnStage);
            }
Example #3
0
            public void two_process_execute_both_tasks_at_stage_zero()
            {
                _q.Process();
                _q.Process();

                Assert.That(_t1.StartedOn(0));
                Assert.That(_t2.StartedOn(0));
            }
Example #4
0
            public void two_process_execute_only_the_first_task()
            {
                _q.Process();
                _q.Process();

                Assert.That(_t1.StartedOn(0));
                Assert.That(!_t2.StartedOn(0));
            }
Example #5
0
            public void first_task_completed_unblocks_both_tasks()
            {
                _t1.Complete();
                _q.Process();
                _q.Process();

                Assert.That(_t1.StartedOn(1));
                Assert.That(_t2.StartedOn(1));
            }
            public void two_process_execute_only_the_first_task()
            {
                _q.Process();
                _q.Process();

                Assert.That(_t1.Executed);
                Assert.AreEqual(0, _t1.ExecutedOnStage);
                Assert.That(!_t2.Executed);
            }
Example #7
0
 public void when()
 {
     _q  = new StagedProcessingQueue(new[] { true, true });
     _t1 = new TestTask(1, 1, 1);
     _t2 = new TestTask(1, 1, 1);
     _q.Enqueue(_t1);
     _q.Process();
     _q.Enqueue(_t2);
     _q.Process();
 }
            public void two_process_execute_both_tasks_at_stage_zero()
            {
                _q.Process();
                _q.Process();

                Assert.That(_t1.Executed);
                Assert.AreEqual(0, _t1.ExecutedOnStage);
                Assert.That(_t2.Executed);
                Assert.AreEqual(0, _t2.ExecutedOnStage);
            }
Example #9
0
 public void when()
 {
     _q  = new StagedProcessingQueue(new[] { false, false, true });
     _t1 = new TestTask(1, 3);
     _t2 = new TestTask(2, 3, 0);
     _q.Enqueue(_t1);
     _q.Enqueue(_t2);
     _q.Process(max: 3);
     _q.Process(max: 3);
     _q.Process(max: 3);
 }
 public void when()
 {
     _q  = new StagedProcessingQueue(new[] { true, true });
     _t1 = new TestTask(1, 2);
     _t2 = new TestTask(2, 2, 0);
     _q.Enqueue(_t1);
     _q.Enqueue(_t2);
     _processed1 = _q.Process();
     _processed2 = _q.Process();
     _processed3 = _q.Process();
 }
            public void first_task_completed_unblocks_both_tasks()
            {
                _t1.Complete();
                var processed4 = _q.Process();
                var processed5 = _q.Process();

                Assert.AreEqual(1, _processed1);
                Assert.AreEqual(2, _processed2);
                Assert.AreEqual(0, _processed3);
                Assert.AreEqual(1, processed4);
                Assert.AreEqual(0, processed5);
            }
 public void when()
 {
     _q  = new StagedProcessingQueue(new[] { false, false, true });
     _t1 = new TestTask(1, 3);
     _t2 = new TestTask(2, 3, 0);
     _t3 = new TestTask(3, 3, 0);
     _q.Enqueue(_t1);
     _q.Enqueue(_t2);
     _q.Enqueue(_t3);
     _processed1 = _q.Process();
     _processed2 = _q.Process();
     _processed3 = _q.Process();
 }
Example #13
0
 public void first_task_keeps_other_blocked_at_stage_two()
 {
     _t1.Complete();
     _q.Process(max: 2);
     _q.Process(max: 2);
     _t2.Complete();
     _t3.Complete();
     _q.Process();
     Assert.That(!_t2.StartedOn(2));
     Assert.That(!_t3.StartedOn(2));
 }
            public void first_task_keeps_other_blocked_at_stage_two()
            {
                _t1.Complete();
                var processed4 = _q.Process();
                var processed5 = _q.Process();

                _t2.Complete();
                _t3.Complete();
                var processed7 = _q.Process();

                Assert.AreEqual(1, _processed1);
                Assert.AreEqual(2, _processed2);
                Assert.AreEqual(2, _processed3);
                Assert.AreEqual(1, processed4);
                Assert.AreEqual(0, processed5);
                Assert.AreEqual(0, processed7);
            }
 public void first_task_starts_on_second_stage_on_first_stage_completion()
 {
     _q.Process();
     Assert.Throws <InvalidOperationException>(() => { _t1.Complete(); });
 }
            public void process_does_not_proces_anything()
            {
                var processed = _q.Process();

                Assert.AreEqual(0, processed);
            }
Example #17
0
            public void first_task_starts_on_second_stage_on_first_stage_completion()
            {
                _q.Process();
                _q.Process();

                _t1.Complete();

                _q.Process();

                Assert.That(_t1.StartedOn(1));
            }
Example #18
0
            public void process_does_not_proces_anything()
            {
                var processed = _q.Process();

                Assert.IsFalse(processed);
            }
            public void process_does_not_execute_a_task()
            {
                _q.Process();

                Assert.That(!_t1.Executed);
            }
Example #20
0
            public void queue_becomes_empty()
            {
                _q.Process(max: 2);

                Assert.That(_q.IsEmpty);
            }
Example #21
0
 public void first_task_starts_on_second_stage_on_first_stage_completion()
 {
     _q.Process();
     _t1.Complete();
 }
Example #22
0
            public void process_executes_the_task_up_to_stage_one()
            {
                _q.Process(max: 2);

                Assert.That(_t1.StartedOn(1));
            }
Example #23
0
            public void process_executes_the_task_at_stage_zero()
            {
                _q.Process();

                Assert.That(_t1.StartedOn(0));
            }
Example #24
0
            public void process_does_not_execute_a_task()
            {
                _q.Process();

                Assert.That(!_t1.StartedOn(0));
            }