Test RecyclableArrayList.ContainsShouldNotFindNonExistingItems and ContainsShouldNotFindAnythingWhenListEmpty added.
This commit is contained in:
1 parent
50353aecc2
commit
681cd179d2
1 file changed
+31
@@ -302,6 +302,37 @@ namespace Recyclable.CollectionsTests
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ContainsShouldNotFindNonExistingItems()
|
||||
{
|
||||
// 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().BeFalse();
|
||||
}
|
||||
|
||||
// Validate
|
||||
_ = list.Contains(0).Should().BeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ContainsShouldNotFindAnythingWhenListEmpty()
|
||||
{
|
||||
// Prepare
|
||||
var testData = _testData.ToArray();
|
||||
using var list = new RecyclableArrayList<int>(testData);
|
||||
|
||||
// Validate
|
||||
_ = list.Contains(0).Should().BeFalse();
|
||||
_ = list.Contains(1).Should().BeTrue();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddShouldAcceptDuplicates()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user