Example #1
0
        public void Enqueue_And_Copy()
        {
            // arrange
            var queue = new SuspendedWorkQueue();
            var task1 = new MockExecutionTask();
            var task2 = new MockExecutionTask();

            // act
            queue.Enqueue(task1);
            queue.Enqueue(task2);

            // assert
            var work         = new WorkQueue();
            var plan         = new QueryPlan(new MockQueryPlanStep());
            var state        = new Mock <IQueryPlanState>();
            var stateMachine = new QueryPlanStateMachine();

            stateMachine.Initialize(state.Object, plan);
            queue.CopyTo(work, work, stateMachine);

            Assert.True(work.TryTake(out IExecutionTask task));
            Assert.Same(task1, task);
            Assert.True(work.TryTake(out task));
            Assert.Same(task2, task);
        }
Example #2
0
        public void Enqueue_One()
        {
            // arrange
            var queue = new SuspendedWorkQueue();
            var task  = new MockExecutionTask();

            // act
            queue.Enqueue(task);

            // assert
            Assert.False(queue.IsEmpty);
            Assert.True(queue.HasWork);
        }