public void AboveZero_ValueTest() { List<int> myList = new List<int>(); myList.Insert(0, 0); myList.Insert(1, 1); myList = Filter.FilterFunction(myList, x => x > 0); Assert.AreEqual(1, myList[0]); }
public void Parity_CountTest() { List<int> myList = new List<int>(); myList.Insert(0, 4); myList.Insert(1, 7); myList.Insert(2, 6); myList = Filter.FilterFunction(myList, x => x % 2 == 0); Assert.AreEqual(2, myList.Count); }
public void OriginalListDoesntChangeTest() { List<int> myList = new List<int>(); myList.Insert(0, 0); myList.Insert(1, 1); Filter.FilterFunction(myList, x => x > 0); Assert.AreEqual(0, myList[0]); Assert.AreEqual(1, myList[1]); }
public void CubeAbove27_ValueTest() { List<int> myList = new List<int>(); myList.Insert(0, 2); myList.Insert(1, 3); myList.Insert(2, 4); myList = Filter.FilterFunction(myList, x => x * x * x > 27); Assert.AreEqual(4, myList[0]); }
public void Parity_ValueTest() { List<int> myList = new List<int>(); myList.Insert(0, 4); myList.Insert(1, 7); myList.Insert(2, 6); myList = Filter.FilterFunction(myList, x => x % 2 == 0); Assert.AreEqual(4, myList[0]); Assert.AreEqual(6, myList[1]); }
public void TestChar() { var list = new List<char>(); list.Insert('v', 0); list.Insert('c', 1); list.Insert('d', 2); var arr = new char[3]; int i = 0; foreach (char x in list) { arr[i] = x; ++i; } Assert.AreEqual('v', arr[0]); Assert.AreEqual('c', arr[1]); Assert.AreEqual('d', arr[2]); }
static void Main(string[] args) { List list = new List(); ListElement pos = list.First(); for (int i = 1; i < 10; ++i) { list.Insert(i, pos); pos = list.Next(pos); } list.PrintList(); pos = list.Next(list.First()); pos = list.Next(pos); list.Remove(pos); list.PrintList(); Console.ReadKey(); }