コード例 #1
0
        public void ShouldBeAbleToMoveTableToNewChildNode()
        {
            // 2 Customers
            ExecutionNode customer = ExecutionNode.CreateLevelOneNode(2, "Customer");

            customer.AddTable(_CustomerTable);

            // Make 2 accounts per customer
            ExecutionNode accounts = customer.AddChild(2, "Accounts");

            accounts.AddTable(_AccountTable);

            NodeIterator it = new NodeIterator(customer);

            Assert.That(it.GetExpectedInsertCount(), Is.EqualTo(6));
            AssertOrder(it.GetTablesRecursive().Select(x => x.Table), "Customer", "Accounts", "Accounts", "Customer", "Accounts", "Accounts");

            accounts.MoveTableToNewChildNode(_AccountTable, 3, "AccountChildNode");
            // total 6 accounts per customer, 2 customers 12 + 2
            Assert.That(it.GetExpectedInsertCount(), Is.EqualTo(14));
            AssertOrder(it.GetTablesRecursive().Select(x => x.Table), "Customer", "Accounts", "Accounts", "Accounts", "Accounts", "Accounts", "Accounts", "Customer", "Accounts", "Accounts", "Accounts", "Accounts", "Accounts", "Accounts");
        }