public void FoldTest() { List list = new List(); list.InsertToTheEnd(1); list.InsertToTheEnd(2); list.InsertToTheEnd(3); ClassForUsing Fo = new ClassForUsing(); int result = Fo.Fold(list, 1, (acc, elem) => acc = acc * elem.GettingFirstValue()); Assert.AreEqual(result, 6); }
public void MapTest() { List list1 = new List(); list1.InsertToTheEnd(1); list1.InsertToTheEnd(2); list1.InsertToTheEnd(3); List list2 = new List(); ClassForUsing M = new ClassForUsing(); list2 = M.Map1(list1, x => x + 5); Assert.AreEqual(list2.Print(), "6 7 8 "); }
public void FilterTest() { List list1 = new List(); list1.InsertToTheEnd(5); list1.InsertToTheEnd(10); list1.InsertToTheEnd(15); list1.InsertToTheEnd(1); list1.InsertToTheEnd(8); List list2 = new List(); ClassForUsing F = new ClassForUsing(); list2 = F.Filter(list1, x => x > 5); System.Console.WriteLine(list2.Print()); Assert.AreEqual(list2.Print(), "10 15 8 "); }