[Test] public void RemoveRangeChokesOnBadCount() { var sut = new CopyOnWriteList <T>(Samples); var e = Assert.Catch <ArgumentOutOfRangeException>(() => sut.RemoveRange(0, -1)); Assert.That(e.ParamName, Is.EqualTo("count")); }
[Test] public void RemoveRangeChokesOnBadIndex(Position position) { var index = PositionToIndex(position); var sut = new CopyOnWriteList <T>(Samples); var e = Assert.Catch <ArgumentOutOfRangeException>(() => sut.RemoveRange(index, 1)); Assert.That(e.ParamName, Is.EqualTo("index")); }
public void RemoveRangeRemovesElementsInSpecifiedRange(Position position, int count) { var index = PositionToIndex(position); var samples = Samples; var sut = new CopyOnWriteList <T>(samples); sut.RemoveRange(index, count); for (int i = 0; i < index; i++) { Assert.That(sut[i], Is.EqualTo(samples[i])); } for (int i = index; i < index - count; i++) { Assert.That(sut[i], Is.EqualTo(samples[i + count])); } }