public void Count_WhenEmpty_ThenZero() { // given testObject = new DoubleHeap <int>(); // when int result = testObject.Count; // then result.Should().Be(0); }
public void GetEnumerator_WhenEmpty_ThenNoElements() { // given testObject = new DoubleHeap <int>(); // when IEnumerator <int> result = testObject.GetEnumerator(); // then result.MoveNext().Should().BeFalse(); }
public void TryGetMin_WhenEmpty_ThenDefaultValue() { // given testObject = new DoubleHeap <int>(); // when bool result = testObject.TryGetMin(out int resultValue); // then result.Should().BeFalse(); resultValue.Should().Be(default);
public void GetMax_WhenEmpty_ThenInvalidOperationException() { // given testObject = new DoubleHeap <int>(); // when Action action = () => testObject.GetMax(); // then action.Should().Throw <InvalidOperationException>(); }
public void GetMax_WhenSingleElement_ThenThisElement() { // given int element = 19; testObject = new DoubleHeap <int>(new[] { element }); // when int result = testObject.GetMax(); // then result.Should().Be(element); }
public void Push_WhenEmpty_ThenAdded() { // given int element = 19; testObject = new DoubleHeap <int>(); // when testObject.Push(element); // then testObject.Should().HaveCount(1); testObject.GetMin().Should().Be(element); testObject.GetMax().Should().Be(element); }
public void GetEnumerator_WhenSingleElement_ThenThisElementOnly() { // given int element = 17; testObject = new DoubleHeap <int>(new[] { element }); // when IEnumerator <int> result = testObject.GetEnumerator(); // then result.MoveNext().Should().BeTrue(); result.Current.Should().Be(element); result.MoveNext().Should().BeFalse(); }
public void SetUp() => testObject = new DoubleHeap <int>(numbers);