Exemplo n.º 1
0
        public void CopyToTest()
        {
            var list = new IndexedLinkedList<int> { 1, 0, -1 };
            var expected = new int[] { 1, 0, -1 };
            var actual = new int[list.Count];
            list.CopyTo(actual, 0);

            CollectionAssert.AreEqual(expected, actual, "The arrays do not match");
        }
Exemplo n.º 2
0
        public void RemoveTest()
        {
            var list = new IndexedLinkedList<int> { 1, 0, -1 };
            list.Remove(0);
            Assert.AreEqual(2, list.Count, "Remove failed, size does not match expected");

            // Dump as array
            var expected = new int[] { 1, -1 };
            var actual = new int[list.Count];
            list.CopyTo(actual, 0);

            CollectionAssert.AreEqual(expected, actual, "Remove failed, The list does not match expected");
        }
Exemplo n.º 3
0
        public void InsertTest()
        {
            var list = new IndexedLinkedList<int> { 1, 0, -1 };
            list.Insert(1, 22);
            Assert.AreEqual(4, list.Count, "InsertAt failed, size does not match expected");

            // Dump as array
            var expected = new int[] { 1, 22, 0, -1 };
            var actual = new int[list.Count];
            list.CopyTo(actual, 0);

            CollectionAssert.AreEqual(expected, actual, "InsertAt failed, The list does not match expected");
        }