Added new tests to RecyclableArrayListTest for Clear and IndexOf.
This commit is contained in:
1 parent
576ac9ccfa
commit
97c0b87c31
1 file changed
+31
@@ -254,5 +254,36 @@ namespace Recyclable.CollectionsTests
|
|||||||
.And.ContainInConsecutiveOrder(testData)
|
.And.ContainInConsecutiveOrder(testData)
|
||||||
.And.BeEquivalentTo(testData);
|
.And.BeEquivalentTo(testData);
|
||||||
}
|
}
|
||||||
|
[Fact]
|
||||||
|
public void ClearShouldRemoveAllItems()
|
||||||
|
{
|
||||||
|
// Prepare
|
||||||
|
var testData = _testData.ToArray();
|
||||||
|
var list = new RecyclableArrayList<int>(testData);
|
||||||
|
_ = list.Count.Should().NotBe(0);
|
||||||
|
|
||||||
|
// Act
|
||||||
|
list.Clear();
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
_ = list.Count.Should().Be(0);
|
||||||
|
_ = list.Should().HaveCount(0);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void IndexOfShouldFindTheIndexes()
|
||||||
|
{
|
||||||
|
// Prepare
|
||||||
|
var testData = _testData.ToArray();
|
||||||
|
using var list = new RecyclableArrayList<int>(testData);
|
||||||
|
|
||||||
|
// Act & Validate
|
||||||
|
foreach (var index in _testData.ToArray())
|
||||||
|
{
|
||||||
|
var actual = list.IndexOf(index);
|
||||||
|
_ = actual.Should().Be(index - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user