public void AddFiveItemsCopyToArray() { var linkedListStackArray = new int[5]; var arrayStackArray = new int[5]; int linkedListStackLast = 0; int arrayStackLast = 0; for (int i = 1; i <= 5; i++) { linkedListStack.Push(i); arrayStack.Push(i); } foreach (var item in linkedListStack.Get()) { linkedListStackLast = item; } foreach (var item in arrayStack.Get()) { arrayStackLast = item; } linkedListStack.CopyTo(linkedListStackArray, 0); arrayStack.CopyTo(arrayStackArray, 0); Assert.AreEqual(linkedListStackLast, 1, "invalid last element"); Assert.AreEqual(arrayStackLast, 1, "invalid last element"); Assert.AreEqual(linkedListStackArray[0], 5, "invalid element"); Assert.AreEqual(arrayStackArray[0], 5, "invalid element"); Assert.AreEqual(linkedListStackArray[4], 1, "invalid element"); Assert.AreEqual(arrayStackArray[4], 1, "invalid element"); }