Example #1
0
        public void GivenAnEmptyHeap_WhenInsertNewValues_ShouldAddThoseValuesOnArray()
        {
            // Arrange
            var heap = new MyHeap();

            // Act
            heap.Insert(10, 5, 17);

            // Assert
            heap.GetAll().Should().BeEquivalentTo(17, 5, 10);
        }
Example #2
0
        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);
        }