public void ShouldThrowExceptionWhenGivenIndexIsOutOfRange() { Vector <int> empty = new ArrayVector <int>(); var actions = new Action[] { () => empty.With(0, 0), () => empty.With(-1, -1), () => { int value = empty[0]; }, () => { int value = empty[-1]; } }; foreach (var action in actions) { action.ShouldThrow <IndexOutOfRangeException>("Index was outside the bounds of the vector."); } }
private static Vector <int> SliceDigits(int startIndexInclusive, int endIndexExclusive) { var digits = new ArrayVector <int>(0, 1, 2, 3, 4, 5, 6, 7, 8, 9); return(digits.Slice(startIndexInclusive, endIndexExclusive)); }
public void ShouldCreateSlices() { Vector <int> slice = new ArrayVector <int>(0, 1, 2, 3, 4, 5, 6).Slice(1, 6); slice.ShouldList(1, 2, 3, 4, 5); }