Esempio n. 1
0
        public void Add()
        {
            var list = new CoordinateList <int>();
            var c    = new Coordinate <int>(13, 14);

            list.Add(c);
            Assert.AreEqual(1, list.Count);

            list.Add(23, 24);
            Assert.AreEqual(2, list.Count);
        }
Esempio n. 2
0
        public void Equals()
        {
            var list1 = new CoordinateList <int>();
            var list2 = new CoordinateList <int>();
            var c     = new Coordinate <int>(13, 14);

            list1.Add(c);
            Assert.IsFalse(list1.Equals(list2));

            list2.Add(c);
            Assert.IsTrue(list1.Equals(list2));
        }
Esempio n. 3
0
        public void ToArray()
        {
            var list = new CoordinateList <int>();
            var c    = new Coordinate <int>(13, 14);

            int[] array = list.ToArray();
            Assert.IsNull(array);

            list.Add(c);
            array = list.ToArray();
            Assert.AreEqual(2, array.Length);
        }
Esempio n. 4
0
        public void ForEach()
        {
            var list = new CoordinateList <int>();

            for (int i = 0; i < 10; i++)
            {
                list.Add(new Coordinate <int>(i, 2 * i));
            }

            int count = 0;

            list.ForEach(c =>
            {
                Assert.IsTrue(c == new Coordinate <int>(count, 2 * count));
                count++;
            });
            Assert.AreEqual(list.Count, count);
        }
Esempio n. 5
0
        public void Enumerator()
        {
            var list = new CoordinateList <int>();

            for (int i = 0; i < 10; i++)
            {
                list.Add(new Coordinate <int>(i, 2 * i));
            }

            int count = 0;

            foreach (var c in list)
            {
                Assert.IsTrue(c == new Coordinate <int>(count, 2 * count));
                count++;
            }
            Assert.AreEqual(list.Count, count);
        }