public void TrimToCount(int capacity, int extraElements, int newCount, int[] expected) { // Arrange var collection = new PushOutCollection <int>(capacity); PopulateCollection(collection, capacity + extraElements); // Act collection.TrimTo(newCount); // Assert Assert.Equal(expected, collection); }
private bool TryAddSnapshotInternal(ref LineViewSnapshot snapshot) { if (EqualsToCurrentSnapshot(ref snapshot)) { return(false); } if (_iterator.HasNext()) { _snapshots.TrimTo(_iterator.Index + 1); } _snapshots.Add(snapshot); _iterator.MoveToLast(); return(true); }