Пример #1
0
        public void ReverseList_True()
        {
            var head  = new ListNode(1);
            var node2 = new ListNode(2);
            var node3 = new ListNode(3);
            var node4 = new ListNode(4);
            var node5 = new ListNode(5);

            head.next  = node2;
            node2.next = node3;
            node3.next = node4;
            node4.next = node5;

            var expectedOutput = "5,4,3,2,1";
            var output         = _linkedListService.ReverseListV1(head);
            var actualOutput   = _linkedListService.GetListValues(output);

            Assert.Equal(expectedOutput, actualOutput);
        }