Beispiel #1
0
        public void Add()
        {
            // Create a new heap.
            ConcurrentBinaryMinHeap <int> heap = new ConcurrentBinaryMinHeap <int>();

            // Ensure that the heap is empty.
            Assert.That(heap.Count, Is.EqualTo(0));

            // Call Add() to insert a new element to the queue as a PriorityValuePair.
            heap.Add(new PriorityValuePair <int>(1f, 2));

            // Expect a value of 2 on the first item to be removed after adding it.
            Assert.That(heap.PopValue(), Is.EqualTo(2));
        }