예제 #1
0
        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);
        }
예제 #2
0
        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  ");
        }
예제 #3
0
        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  ");
        }