public void Test_Swap() { var list = new[] { 1, 2, 3 }; list.Swap(0, 2); Assert.AreEqual(list[0], 3); }
public void ListExtensions_Manipulate_Swap() { var arr = new[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; //reverse list in place for (int i = 0; i < 5; i++) arr.Swap(i, 9 - i); for (int i = 0; i <= 9; i++) Assert.AreEqual(9 - i, arr[i]); }