Beispiel #1
0
        private void NullTreeTest(IBSTToLinkedListConverter bSTToLinkedListConverter)
        {
            TreeNode bst = null;

            int[]          expected = null;
            LinkedListNode result   = bSTToLinkedListConverter.Convert(bst);

            Assert.AreEqual(expected, result);
        }
Beispiel #2
0
        private void ConversionTest(IBSTToLinkedListConverter bSTToLinkedListConverter)
        {
            TreeNode bst = CreateBST();

            int[]          expected = new int[] { 3, 6, 7, 10, 13, 16, 19 };
            LinkedListNode result   = bSTToLinkedListConverter.Convert(bst);

            for (int i = 0; i < expected.Length; i++)
            {
                Assert.AreEqual(expected[i], result.Value);
                result = result.Next;
            }
        }