Tests for RecyclableArrayList.Contains and RecyclableList.Clear added.

This commit is contained in:
Memek committed 2023-02-06 18:02:50 +01:00
1 parent 360f1c9880
commit 23e92b0521
2 files changed
+33 -2

No files matched your search

@@ -17,7 +17,8 @@ namespace Recyclable.CollectionsTests
// Act
foreach (var item in testData)
{
list.Add(item);
_ = list.Count.Should().Be(item);
}
@@ -285,5 +286,21 @@ namespace Recyclable.CollectionsTests
_ = actual.Should().Be(index - 1);
}
}
[Fact]
public void ContainsShouldFindAllItems()
{
// Prepare
var testData = _testData.ToArray();
using var list = new RecyclableArrayList<int>(testData);
_ = testData.Any().Should().BeTrue("we need items on the list that we can look for");
// Act
foreach (var item in testData)
{
// Validate
_ = list.Contains(item).Should().BeTrue();
}
}
}
}
@@ -137,7 +137,7 @@ namespace Recyclable.CollectionsTests
{
// Prepare
using var list = NewRecyclableList;
// Act
var actual = new int[list.LongCount];
list.CopyTo(actual, 0);
@@ -229,5 +229,19 @@ namespace Recyclable.CollectionsTests
// Act
list.Dispose();
}
[Fact]
public void ClearShouldRemoveAllItems()
{
// Prepare
using var list = NewRecyclableList;
_ = list.LongCount.Should().NotBe(0);
// Act
list.Clear();
// Validate
_ = list.LongCount.Should().Be(0);
}
}
}