Esempio n. 1
0
        public static void TestIEnumetator()
        {
            var list = new List.List();
            int from = 0;
            int to   = 4;

            for (int i = from; i <= to; i++)
            {
                list.Add(i);
            }

            bool result = false;

            foreach (var i in list)
            {
                result = true;
            }

            result = false;

            foreach (var i in list)
            {
                result = true;
            }

            Assert.True(result);
        }
Esempio n. 2
0
        public static void TestAddFirstValue()
        {
            var list  = new List.List();
            int value = 10;

            list.Add(value);

            Assert.AreEqual(value, (int)list[0]);
        }
Esempio n. 3
0
        public void List_Test()
        {
            List.List<int> list = new List.List<int>();
            for (int i = 0; i < 20; i++)
                list.Add(i);

            int sum = 0;
            foreach (int i in list)
                sum += i;

            Assert.IsTrue(sum == 190);
        }
Esempio n. 4
0
        public static List.List GetListIntegers(this string inputString)
        {
            List.List result = new List.List();

            for (int i = 0; i < inputString.Length; i++)
            {
                if (inputString[i] >= '0' && inputString[i] <= '9')
                {
                    result.Add((int)inputString[i]);
                }
            }
            return(result);
        }
Esempio n. 5
0
        public static void TestAddFifyhValues()
        {
            var list = new List.List();

            int from = 0;
            int to   = 4;

            for (int i = from; i <= to; i++)
            {
                list.Add(i);
            }

            Assert.AreEqual(to, (int)list[to]);
        }
Esempio n. 6
0
        static void RunList()
        {
            List.List<int> list = new List.List<int>();
            for (int i = 0; i < 20; i++)
                list.Add(i);

            foreach (int i in list)
                Console.WriteLine(i);

            int[] arr = list.ToArray();
            foreach (int i in arr)
                Console.Write(i + " ");

            Console.WriteLine();
            Console.WriteLine(arr.Length);
        }
Esempio n. 7
0
        public static void TestCountFourValues()
        {
            var list = new List.List();

            int from = 0;
            int to   = 3;

            for (int i = from; i <= to; i++)
            {
                list.Add(i);
            }

            int expectedResult = to + 1;

            Assert.AreEqual(expectedResult, list.Count);
        }
Esempio n. 8
0
        public static void TestAddFourValues()
        {
            var list = new List.List();

            int from = 0;
            int to   = 3;

            for (int i = from; i <= to; i++)
            {
                list.Add(i);
            }

            for (int i = from; i <= to; i++)
            {
                Assert.AreEqual(i, (int)list[i]);
            }
        }
Esempio n. 9
0
        public static void TestContains()
        {
            var list = new List.List();

            int from = 0;
            int to   = 3;

            for (int i = from; i <= to; i++)
            {
                list.Add(i);
            }

            for (int i = from; i <= to; i++)
            {
                Assert.True(list.Contains(i));
            }
            Assert.False(list.Contains(list.Contains(5)));
        }
Esempio n. 10
0
        public static void TestClear()
        {
            var list = new List.List();

            int from = 0;
            int to   = 8;

            for (int i = from; i <= to; i++)
            {
                list.Add(i);
            }

            list.Clear();

            int expectedResult = 0;

            Assert.AreEqual(expectedResult, list.Count);
        }
Esempio n. 11
0
        public static void TestRemoveAt()
        {
            var list = new List.List();

            int from = 0;
            int to   = 4;

            for (int i = from; i <= to; i++)
            {
                list.Add(i);
            }

            list.RemoveAt(0);

            int expectedResult = 4;

            Assert.AreEqual(expectedResult, list.Count);
        }