Tests for RecyclableArrayList.Contains and RecyclableList.Clear added.
This commit is contained in:
1 parent
360f1c9880
commit
23e92b0521
2 files changed
+33
-2
No files matched your search
@@ -17,7 +17,8 @@ namespace Recyclable.CollectionsTests
|
|||||||
// Act
|
// Act
|
||||||
foreach (var item in testData)
|
foreach (var item in testData)
|
||||||
{
|
{
|
||||||
list.Add(item);
|
|
||||||
|
|
||||||
_ = list.Count.Should().Be(item);
|
_ = list.Count.Should().Be(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -285,5 +286,21 @@ namespace Recyclable.CollectionsTests
|
|||||||
_ = actual.Should().Be(index - 1);
|
_ = 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
|
// Prepare
|
||||||
using var list = NewRecyclableList;
|
using var list = NewRecyclableList;
|
||||||
|
|
||||||
// Act
|
// Act
|
||||||
var actual = new int[list.LongCount];
|
var actual = new int[list.LongCount];
|
||||||
list.CopyTo(actual, 0);
|
list.CopyTo(actual, 0);
|
||||||
@@ -229,5 +229,19 @@ namespace Recyclable.CollectionsTests
|
|||||||
// Act
|
// Act
|
||||||
list.Dispose();
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user