Example #1
0
        public void TreeEntityExtensions_GetPostfixTree()
        {
            TestTree tree  = new TestTree();
            TreeNode node1 = new TreeNode();

            tree.SetRootNode(node1);

            TreeNode node2 = new TreeNode();
            TreeNode node3 = new TreeNode();

            node1.AppendChild(node2);
            node1.AppendChild(node3);

            TreeNode node4 = new TreeNode();

            node2.AppendChild(node4);
            TreeNode node5 = new TreeNode();
            TreeNode node6 = new TreeNode();

            node3.AppendChild(node5);
            node3.AppendChild(node6);

            List <TreeNode> list = TreeEntityExtensions.GetPostfixTree(tree).ToList();

            Assert.Equal(new TreeNode[]
            {
                node4,
                node2,
                node5,
                node6,
                node3,
                node1
            }, list);
        }
Example #2
0
 public void TreeEntityExtensions_GetPostfixTree_NullTree()
 {
     Assert.Throws <ArgumentNullException>(() => TreeEntityExtensions.GetPostfixTree(null));
 }