public void IsAccurateWhenAddingAndRemoving(PositiveInt itemsToAdd, int randomSeed) { var itemCount = itemsToAdd.Get; var random = new System.Random(randomSeed); var list = new DeletableObjectList <TestDeletable>(); foreach (var i in Enumerable.Range(1, itemCount)) { list.Add(new TestDeletable()); Assert.Equal(i, list.ApproximateCount); } foreach (var i in Enumerable.Range(1, itemCount)) { list.Remove(list.RandomElement(random)); Assert.Equal(itemCount - i, list.ApproximateCount); } }
protected override void CallMethod(DeletableObjectList <TestDeletable> list) => list.Remove(list.RandomElement(random));