Example #1
0
        public void SingleListTest()
        {
            SingleList <TestEntity> list = new SingleList <TestEntity>();

            Assert.AreEqual(0, list.Count);

            var link1 = new TestEntity(1);

            list.AddFirst(link1);

            Assert.AreEqual(1, list.Count);
            Assert.AreEqual(link1, list.First);

            var link2 = new TestEntity(2);

            SingleList <TestEntity> .AddAfter(link1, link2);

            Assert.AreEqual(2, list.Count);

            var link3 = new TestEntity(2);

            SingleList <TestEntity> .AddAfter(link2, link3);

            Assert.AreEqual(3, list.Count);

            list.RemoveFirst();

            Assert.AreEqual(2, list.Count);
            Assert.AreEqual(link2, list.First);

            SingleList <TestEntity> .RemoveAfter(link2);

            Assert.AreEqual(1, list.Count);

            list.RemoveFirst();

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