public void NodesAreExtractedInOrderOfLowerPriority2() { var pQueue = new PQueue(); var node1 = pQueue.Insert("A:11"); var node2 = pQueue.Insert("A:12"); var node3 = pQueue.Insert("A:13"); pQueue.IncreasePriority(node1); var extractedNodeA = pQueue.Extract(); Assert.AreEqual(node2, extractedNodeA); pQueue.IncreasePriority(node3); var extractedNodeB = pQueue.Extract(); Assert.AreEqual(node1, extractedNodeB); }
public void IncreasePriorityWorksWithOneObject() { var pQueue = new PQueue(); string key = "theKey"; var createdNode = pQueue.Insert(key); int originalPriority = createdNode.Priority; pQueue.IncreasePriority(createdNode); var extractedNode = pQueue.Extract(); Assert.IsTrue(extractedNode.Priority > originalPriority); }