示例#1
0
        public void TestClear()
        {
            DynamicList <int> expected = new DynamicList <int>()
            {
            };
            DynamicList <int> actual = new DynamicList <int>()
            {
                1, 2, 3, 4
            };

            actual.Clear();
            Assert.IsTrue(expected.Equals(actual));
        }
示例#2
0
        public void TestRemoveByValue()
        {
            DynamicList <int> expected = new DynamicList <int>()
            {
                1, 2, 4
            };
            DynamicList <int> actual = new DynamicList <int>()
            {
                1, 2, 3, 4
            };

            actual.Remove(3);
            Assert.IsTrue(expected.Equals(actual));
        }
示例#3
0
        public void TestForeach()
        {
            DynamicList <int> expected = new DynamicList <int>()
            {
                1, 4, 9, 16
            };
            DynamicList <int> temp = new DynamicList <int>()
            {
                1, 2, 3, 4
            };
            DynamicList <int> actual = new DynamicList <int>()
            {
            };

            foreach (int el in temp)
            {
                actual.Add(el * el);
            }
            Assert.IsTrue(expected.Equals(actual));
        }