protected override void OnAdded(int index, TSource value) { if (_predicate.Invoke(value)) { _values.Insert(index, true); ++Value; } else _values.Insert(index, false); }
public void RandomlyInsertItems() { RandomGenerator.ResetRandomGenerator(); var list = new List <bool>(); var sut = new BooleanList(); foreach (var value in Enumerable.Range(0, MaxCount)) { var newIndex = RandomGenerator.GenerateRandomInteger(0, list.Count + 1); var newValue = RandomGenerator.GenerateRandomInteger(0, 2) == 0; list.Insert(newIndex, newValue); sut.Insert(newIndex, newValue); ValidateLists(list, sut); } }