RecyclableLongList.Insert implementation finished. Tests added.

This commit is contained in:
mlemanczyk committed 2023-08-05 21:13:32 +02:00
1 parent 5a2ae1c261
commit 128639fd5e
2 files changed
+49 -7

No files matched your search

@@ -530,13 +530,19 @@ namespace Recyclable.CollectionsTests
[Theory]
[MemberData(nameof(RecyclableLongListTestData.SourceTargetDataVariants), MemberType = typeof(RecyclableLongListTestData))]
public void InsertShouldRaiseNotSupportedException(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
public void InsertAtTheEndShouldAppend(string testCase, IEnumerable<long> testData, long itemsCount, int targetBlockSize)
{
// Prepare
using var list = new RecyclableLongList<long>(testData, minBlockSize: targetBlockSize);
// Act
_ = Assert.Throws<NotSupportedException>(() => list.Insert(0, -1));
list.Insert(itemsCount, -1);
// Assert
list.LongCount.Should().Be(itemsCount + 1);
list.LongCount.Should().Be(list.Count);
list[list.LongCount - 1].Should().Be(-1);
}
[Fact]