Exemple #1
0
        public void HeadRemovalTest()
        {
            CyclicList <int> c = new CyclicList <int>();

            c.Add(1);
            c.Add(2);
            c.Add(3);

            c.Remove(0);
            Debug.WriteLine(c[0].ToString() + c[1].ToString() + c[2].ToString());

            Assert.AreEqual(c[0], 2);
            Assert.AreEqual(c[1], 3);
            Assert.AreEqual(c[2], 2);
            Assert.AreEqual(c[3], 3);

            c.Remove(0);
            Assert.AreEqual(3, c[0]);
            c.Remove(0);
            Assert.ThrowsException <Exception>(() => { Debug.WriteLine(c[0]); });
        }
Exemple #2
0
        public void RemoveTest()
        {
            CyclicList <int> c = new CyclicList <int>();

            c.Add(1);
            c.Add(2);
            c.Add(3);

            c.Remove(1);

            Assert.AreEqual(c[0], 1);
            Assert.AreEqual(c[1], 3);
            Assert.AreEqual(c[2], 1);
            Assert.AreEqual(c[3], 3);
        }