Esempio n. 1
0
        public void InsertFirstTwoValues_Expect_CountEqualTwo()
        {
            var linkedList = new WsLinkedList();

            linkedList.InsertFirst(2);
            linkedList.InsertFirst(3);

            Assert.Equal(2, linkedList.Count);
        }
Esempio n. 2
0
        public void InsertFirstTwoValues_Expect_LastEqualHead_FirstEqualTail()
        {
            var linkedList = new WsLinkedList();

            linkedList.InsertFirst(2);
            linkedList.InsertFirst(3);

            Assert.Equal(2, linkedList.Tail.Value);
            Assert.Equal(3, linkedList.Head.Value);
        }
Esempio n. 3
0
        public void InsertNodeBeforeInMiddle_Expect_CorrectCount()
        {
            var linkedList = new WsLinkedList();

            linkedList.InsertFirst(2);
            linkedList.InsertFirst(3);

            linkedList.InsertBefore(2, 1);

            Assert.Equal(3, linkedList.Count);
        }
Esempio n. 4
0
        public void InsertThree_Expect_FindThree()
        {
            var linkedList = new WsLinkedList();

            linkedList.InsertFirst(2);
            linkedList.InsertFirst(3);

            var valueFound = linkedList.Find(3);

            Assert.NotNull(valueFound);
            Assert.Equal(3, valueFound.Value);
        }
Esempio n. 5
0
        public void InsertNodeBeforeInMiddle_Expect_OrderPersisted()
        {
            var linkedList = new WsLinkedList();

            linkedList.InsertFirst(2);
            linkedList.InsertFirst(3);

            linkedList.InsertBefore(2, 1);

            var arr = linkedList.ToArray();

            Assert.Equal(3, arr[0]);
            Assert.Equal(1, arr[1]);
            Assert.Equal(2, arr[2]);
        }
Esempio n. 6
0
        public void InsertFirst_Expect_EqualHead()
        {
            var linkedList = new WsLinkedList();

            linkedList.InsertFirst(2);

            Assert.NotNull(linkedList.Head);
            Assert.Equal(2, linkedList.Head.Value);
        }
Esempio n. 7
0
        public void LinkedListToArray_Expect_AllValuesIncluded()
        {
            var linkedList = new WsLinkedList();

            linkedList.InsertLast(2);
            linkedList.InsertLast(3);
            linkedList.InsertFirst(6);

            var arr = linkedList.ToArray();

            Assert.Equal(6, arr[0]);
            Assert.Equal(2, arr[1]);
            Assert.Equal(3, arr[2]);
        }