public void SynchronisedMaxPriorityQueueMovesNextHighestPriorityItemToHeadAfterDequeueItem()
        {
            var priorityQueue = new SynchronisedMaxPriorityQueue <string, int>(50);

            List <Tuple <string, int> > items = new List <Tuple <string, int> >
            {
                new Tuple <string, int>("A_50", 50),
                new Tuple <string, int>("A_41", 41),
                new Tuple <string, int>("A_38", 38),
                new Tuple <string, int>("A_37", 37),
                new Tuple <string, int>("A_23", 23),
                new Tuple <string, int>("A_11", 11),
                new Tuple <string, int>("A_5", 5),
                new Tuple <string, int>("A_3", 3),
            }.Randomize()
            .ToList();

            priorityQueue.EnqueueRange(items);

            priorityQueue.Dequeue();

            string item = priorityQueue.Peek();

            Assert.AreEqual("A_41", item);
        }
        public void SynchronisedMaxPriorityQueueDequeueReturnsItemWithHighestPriorityMultiThread()
        {
            var priorityQueue = new SynchronisedMaxPriorityQueue <string, int>(50);

            List <Tuple <string, int> > items = new List <Tuple <string, int> >
            {
                new Tuple <string, int>("A_50", 50),
                new Tuple <string, int>("A_41", 41),
                new Tuple <string, int>("A_38", 38),
                new Tuple <string, int>("A_37", 37),
                new Tuple <string, int>("A_23", 23),
                new Tuple <string, int>("A_11", 11),
                new Tuple <string, int>("A_5", 5),
                new Tuple <string, int>("A_3", 3),
            }.Randomize()
            .ToList();
            List <Task> tasks = new List <Task>();

            items.ForEach(i => tasks.Add(Task.Factory.StartNew(() => priorityQueue.Enqueue(i.Item1, i.Item2))));
            Task.WaitAll(tasks.ToArray());

            string item = priorityQueue.Dequeue();

            Assert.AreEqual("A_50", item);
        }
        public void SynchronisedMaxPriorityQueueDequeuDoesRemoveItemFromQueue()
        {
            var priorityQueue = new SynchronisedMaxPriorityQueue <string, int>(50);

            List <Tuple <string, int> > items = new List <Tuple <string, int> >
            {
                new Tuple <string, int>("A_50", 50),
                new Tuple <string, int>("A_41", 41),
                new Tuple <string, int>("A_38", 38),
                new Tuple <string, int>("A_37", 37),
                new Tuple <string, int>("A_23", 23),
                new Tuple <string, int>("A_11", 11),
                new Tuple <string, int>("A_5", 5),
                new Tuple <string, int>("A_3", 3),
            }.Randomize()
            .ToList();

            priorityQueue.EnqueueRange(items);

            priorityQueue.Dequeue();

            Assert.AreEqual(7, priorityQueue.Count);
        }