Esempio n. 1
0
        public void ForEachTestThreeList()
        {
            List <int> result = new List <int>();

            threeList.ForEach(delegate(int a)
            {
                result.Add(a);
            });
            Assert.AreEqual(3, result.Count);
            Assert.AreEqual(2, result[0]);
            Assert.AreEqual(3, result[1]);
            Assert.AreEqual(4, result[2]);
        }
Esempio n. 2
0
        public void ForEachTestEmptyList()
        {
            List <int> result = new List <int>();

            emptyList.ForEach(delegate(int a)
            {
                result.Add(a);
            });
            Assert.AreEqual(0, result.Count);
        }
Esempio n. 3
0
        public void ForEachTestOneList()
        {
            List <int> result = new List <int>();

            oneList.ForEach(delegate(int a)
            {
                result.Add(a);
            });
            Assert.AreEqual(1, result.Count);
            Assert.AreEqual(42, result[0]);
        }
Esempio n. 4
0
        public void ForEachTestTwoList()
        {
            List <int> result = new List <int>();

            twoList.ForEach(delegate(int a)
            {
                result.Add(a);
            });
            Assert.AreEqual(2, result.Count);
            Assert.AreEqual(37, result[0]);
            Assert.AreEqual(51, result[1]);
        }