Exemple #1
0
        public void Test_All_ListNode_is_4_1()
        {
            var node = new ListNode(4);

            node.next = new ListNode(1);

            var expected = new List <int>()
            {
                4, 1
            };

            expected.ToExpectedObject().ShouldEqual(node.All());
        }
        public IEnumerable <int> All()
        {
            var result = new List <int>();

            result.Add(this.val);

            if (this.next != null)
            {
                result.AddRange(next.All());
            }

            return(result);
        }
Exemple #3
0
 private static void AssertResult(ListNode expected, ListNode l1, ListNode l2)
 {
     expected.All().ToExpectedObject().ShouldEqual(new Solution().AddTwoNumbers(l1, l2).All());
 }