From 32d915087f7334718f4bc61ffc2908278fa1741f Mon Sep 17 00:00:00 2001 From: Memek Date: Tue, 7 Feb 2023 17:08:01 +0100 Subject: [PATCH] Test RecyclableList.AddRangeShouldAddItemsInCorrectOrderWhenSourceIsArray and AddRangeShouldAddItemsInCorrectOrderWhenSourceIsList added. --- .../RecyclableListTests.cs | 37 ++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/Recyclable.CollectionsTests/RecyclableListTests.cs b/Recyclable.CollectionsTests/RecyclableListTests.cs index 1159dc8..56e79c7 100644 --- a/Recyclable.CollectionsTests/RecyclableListTests.cs +++ b/Recyclable.CollectionsTests/RecyclableListTests.cs @@ -243,5 +243,40 @@ namespace Recyclable.CollectionsTests // Validate _ = list.LongCount.Should().Be(0); } + + [Fact] + public void AddRangeShouldAddItemsInCorrectOrderWhenSourceIsArray() + { + // Prepare + var testData = _testData.ToArray(); + var list = new RecyclableList(); + + + // Act + list.AddRange(testData); + + // Validate + _ = list.Capacity.Should().Be(16384,"when capacity == 0, then we allocate as much memory as needed, only"); + _ = list.Should().HaveCount(testData.Length) + .And.ContainInConsecutiveOrder(testData) + .And.BeEquivalentTo(testData); + } + + [Fact] + public void AddRangeShouldAddItemsInCorrectOrderWhenSourceIsList() + { + // Prepare + var testData = _testData.ToList(); + var list = new RecyclableList(); + + // Act + list.AddRange(testData); + + // Validate + _ = list.Capacity.Should().Be(16384, "when capacity == 0, then we allocate as much memory as needed, only"); + _ = list.Should().HaveCount(testData.Count) + .And.ContainInConsecutiveOrder(testData) + .And.BeEquivalentTo(testData); + } } -} \ No newline at end of file +}