public void GivenAHeapWithSomeItems_WhenRemoveTheRootValue_ShouldRebalanceTheHeap() { // Arrange var heap = new MyHeap(); heap.Insert(10, 5, 17, 4, 22); // Act heap.Remove(); // Assert heap.GetAll().First().Should().Be(17); }
public void TestMinHeap() { var minHeapComparer = new HeapItemComparer <int>(true); var heap = new MyHeap <int>(10, minHeapComparer); heap.Insert(1); heap.Insert(20); heap.Insert(300); heap.Insert(4000); heap.Insert(25000); var root = heap.Remove(); Assert.IsTrue(root == 3); }