public void CantCopyToArrayOfSmallerSize() { var list = new ChunkedList <int>(); for (int i = 0; i < 10; i++) { list.Add(i); } var arr = new int[5]; Trap.Exception(() => list.CopyTo(arr, 0)).ShouldBeInstanceOf <ArgumentOutOfRangeException>(); }
public void CanCopyToArrayFromIndex() { var list = new ChunkedList <int>(); for (int i = 0; i < 10; i++) { list.Add(i); } var arr = new int[20]; list.CopyTo(arr, 10); for (int i = 10; i < 20; i++) { arr[i].ShouldEqual(i - 10); } }
public void CanCopyToArray() { var list = new ChunkedList <int>(); for (int i = 0; i < 10; i++) { list.Add(i); } var arr = new int[10]; list.CopyTo(arr, 0); for (int i = 0; i < 10; i++) { arr[i].ShouldEqual(i); } }