Contains() публичный Метод

Determines whether the specified handle is contained within the queue.
public Contains ( ProcessQueueHandle handle ) : bool
handle ProcessQueueHandle The handle to look for.
Результат bool
        public void ShouldRemoveHandleFromQueue()
        {
            var queue = new ProcessQueue();
            Action action = () => { };

            var handle1 = queue.Add(action);
            var handle2 = queue.Add(action);
            var handle3 = queue.Add(action);

            queue.Count.ShouldBe(3);
            queue.Remove(null);
            queue.Count.ShouldBe(3);

            queue.Remove(handle1);
            queue.Count.ShouldBe(2);
            queue.Contains(handle1).ShouldBe(false);

            handle2.Position.ShouldBe(0);
            handle3.Position.ShouldBe(1);

            queue.Remove(handle2);
            queue.Remove(handle3);
            queue.Count.ShouldBe(0);

            // --
            queue.Remove(handle1);
            queue.Remove(handle2);
            queue.Remove(handle3);
        }
        public void ShouldDetermineIfHandleIsContainedWithinQueue()
        {
            var queue = new ProcessQueue();
            Action action = () => { };
            queue.Contains(null).ShouldBe(false);

            var handle1 = queue.Add(action);
            queue.Contains(handle1).ShouldBe(true);

            queue.Remove(handle1);
            queue.Contains(handle1).ShouldBe(false);
        }
        public void ShouldBeAbleToProcessEvenIfRemovedFromQueue()
        {
            var queue = new ProcessQueue();

            var processCount = 0;
            Action action = () => { processCount++; };

            var handle1 = queue.Add(action);
            handle1.Remove();
            queue.Contains(handle1).ShouldBe(false);
            queue.Count.ShouldBe(0);

            handle1.IsProcessed.ShouldBe(false);
            handle1.IsQueued.ShouldBe(false);
            processCount.ShouldBe(0);

            handle1.Process();
            processCount.ShouldBe(1);
            handle1.IsProcessed.ShouldBe(true);
        }
        public void ShouldCancelProcessViaQueueEvent()
        {
            var queue = new ProcessQueue();
            var processCount = 0;
            Action action = () => { processCount++; };

            var handle1 = queue.Add(action);
            queue.Contains(handle1).ShouldBe(true);

            // Cancel the process when the pre-event fires.
            queue.Processing += (s, e) => { e.Cancel = true; };

            // Attempt to process.
            handle1.Process();
            processCount.ShouldBe(0);
            handle1.IsProcessed.ShouldBe(false);
            handle1.IsQueued.ShouldBe(false);

            // Cancelled item should be removed from queue.
            queue.Contains(handle1).ShouldBe(false);
        }
        public void ShouldProcessAndBeRemovedFromQueue()
        {
            var queue = new ProcessQueue();
            Action action = () => { };

            var handle1 = queue.Add(action);
            var handle2 = queue.Add(action);

            handle1.IsProcessed.ShouldBe(false);
            handle2.IsProcessed.ShouldBe(false);

            handle1.Process();
            handle1.IsProcessed.ShouldBe(true);
            queue.Count.ShouldBe(1);
            queue.Contains(handle1).ShouldBe(false);
        }