Missing IList<T> interface added. Tiny cleanup.
This commit is contained in:
1 parent
8067bfb542
commit
4bfb40007a
2 files changed
+18
-10
No files matched your search
@@ -4,7 +4,7 @@ using System.Runtime.CompilerServices;
|
|||||||
|
|
||||||
namespace Recyclable.Collections
|
namespace Recyclable.Collections
|
||||||
{
|
{
|
||||||
public class RecyclableArrayList<T> : IEnumerable<T>, IDisposable
|
public class RecyclableArrayList<T> : IEnumerable<T>, IList<T>, IDisposable
|
||||||
{
|
{
|
||||||
private static readonly ArrayPool<T> _arrayPool = ArrayPool<T>.Create();
|
private static readonly ArrayPool<T> _arrayPool = ArrayPool<T>.Create();
|
||||||
private static readonly IEqualityComparer<T> _equalityComparer = EqualityComparer<T>.Default;
|
private static readonly IEqualityComparer<T> _equalityComparer = EqualityComparer<T>.Default;
|
||||||
@@ -296,15 +296,6 @@ namespace Recyclable.Collections
|
|||||||
}
|
}
|
||||||
|
|
||||||
_count = targetIndex;
|
_count = targetIndex;
|
||||||
|
|
||||||
//foreach (var item in source)
|
|
||||||
//{
|
|
||||||
// if (capacity == count)
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Add(item);
|
|
||||||
//}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Clear()
|
public void Clear()
|
||||||
|
|||||||
@@ -237,5 +237,22 @@ namespace Recyclable.CollectionsTests
|
|||||||
.And.ContainInConsecutiveOrder(testData)
|
.And.ContainInConsecutiveOrder(testData)
|
||||||
.And.BeEquivalentTo(testData);
|
.And.BeEquivalentTo(testData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
public void CopyToShouldCopyAllItemsInTheCorrectOrder()
|
||||||
|
{
|
||||||
|
// Prepare
|
||||||
|
var testData = _testData.ToArray();
|
||||||
|
var list = new RecyclableArrayList<int>(testData);
|
||||||
|
int[] yieldedItems = new int[testData.Length];
|
||||||
|
|
||||||
|
// Act
|
||||||
|
list.CopyTo(yieldedItems, 0);
|
||||||
|
|
||||||
|
// Validate
|
||||||
|
_ = yieldedItems.Should().HaveCount(testData.Length)
|
||||||
|
.And.ContainInConsecutiveOrder(testData)
|
||||||
|
.And.BeEquivalentTo(testData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user