diff --git a/Recyclable.CollectionsTests/RecyclableArrayListTests.cs b/Recyclable.CollectionsTests/RecyclableArrayListTests.cs index ea2b392..7b6f475 100644 --- a/Recyclable.CollectionsTests/RecyclableArrayListTests.cs +++ b/Recyclable.CollectionsTests/RecyclableArrayListTests.cs @@ -303,35 +303,66 @@ namespace Recyclable.CollectionsTests } [Fact] - public void AddShouldAcceptDuplicates() + public void ContainsShouldNotFindNonExistingItems() { // Prepare - int[] testNumbers = new[] { 1, 2, 2, 3 }; + var testData = _testData.ToArray(); + using var list = new RecyclableArrayList(testData); + _ = testData.Any().Should().BeTrue("we need items on the list that we can look for"); // Act - using var list = new RecyclableArrayList(); - foreach (var index in testNumbers) + foreach (var item in testData) { - list.Add(index); + // Validate + _ = list.Contains(-item).Should().BeFalse(); } // Validate - _ = list.Count.Should().Be(testNumbers.Length); - _ = list.Should().BeEquivalentTo(testNumbers); + _ = list.Contains(0).Should().BeFalse(); } [Fact] - public void ConstructorShouldAcceptDuplicates() + public void ContainsShouldNotFindAnythingWhenListEmpty() { // Prepare - int[] testNumbers = new[] { 1, 2, 2, 3 }; - - // Act - using var list = new RecyclableArrayList(testNumbers); + var testData = _testData.ToArray(); + using var list = new RecyclableArrayList(testData); // Validate - _ = list.Count.Should().Be(testNumbers.Length); - _ = list.Should().BeEquivalentTo(testNumbers); + _ = list.Contains(0).Should().BeFalse(); + _ = list.Contains(1).Should().BeTrue(); } - } -} \ No newline at end of file + + [Fact] + public void AddShouldAcceptDuplicates() + { + // Prepare + int[] testNumbers = new[] { 1, 2, 2, 3 }; + + // Act + using var list = new RecyclableArrayList(); + foreach (var index in testNumbers) + { + list.Add(index); + } + + // Validate + _ = list.Count.Should().Be(testNumbers.Length); + _ = list.Should().BeEquivalentTo(testNumbers); + } + + [Fact] + public void ConstructorShouldAcceptDuplicates() + { + // Prepare + int[] testNumbers = new[] { 1, 2, 2, 3 }; + + // Act + using var list = new RecyclableArrayList(testNumbers); + + // Validate + _ = list.Count.Should().Be(testNumbers.Length); + _ = list.Should().BeEquivalentTo(testNumbers); + } + } + } \ No newline at end of file