void PrepareEmployeeTerritories(out TableNode tn) { ApplicationController.WizardControllerFactory = new WizardControllerFactory(this.GetType().Assembly, "TestApp.RelationTests+IntermediateTableWizController"); // Find Territories, map primary key, since it's not automatically detected, // and map class TreeNodeCollection nodes = ApplicationController.Instance.DatabaseNode.Nodes; tn = (TableNode)FindNode(nodes, "Territories"); ColumnNode cn = (ColumnNode)FindNode(tn.Nodes, "TerritoryID"); cn.ChangePrimary(null, EventArgs.Empty); tn.MapClass(null, EventArgs.Empty); tn.Table.ClassName = "Territory"; // Find Employees and map class tn = (TableNode)FindNode(nodes, "Employees"); tn.MapClass(null, EventArgs.Empty); tn.Table.ClassName = "Employee"; tn = (TableNode)FindNode(nodes, "EmployeeTerritories"); DatabaseNode dbn = (DatabaseNode)tn.Parent; Assertion.AssertNotNull("dbn shouldn't be null", dbn); tn.MapIntermediateTable(null, EventArgs.Empty); }