GetBusinessObjectTreeNode() public method

Returns the TreeNode associated with a particular business object.
public GetBusinessObjectTreeNode ( IBusinessObject businessObject ) : ITreeNode
businessObject IBusinessObject
return ITreeNode
        public void Test_GetBusinessObjectTreeNode_NotInTree()
        {
            //---------------Set up test pack-------------------
            OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation();
            ITreeView treeView = GlobalUIRegistry.ControlFactory.CreateTreeView();
            TreeViewController treeViewController = new TreeViewController(treeView);

            treeViewController.LoadTreeView(organisation);
            //-------------Assert Preconditions -------------
            Assert.AreEqual(1, treeView.Nodes.Count);
            //---------------Execute Test ----------------------
            ITreeNode fetchedTreeNode = treeViewController.GetBusinessObjectTreeNode(new OrganisationTestBO());
            //---------------Test Result -----------------------
            Assert.IsNull(fetchedTreeNode);
        }
 public void Test_SetVisibility_False_ThenTrue_CorrectOrder()
 {
     //---------------Set up test pack-------------------
     ITreeView treeView = GlobalUIRegistry.ControlFactory.CreateTreeView();
     TreeViewController treeViewController = new TreeViewController(treeView);
     OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation();
     ContactPersonTestBO contactPerson1 = CreateUnsavedContactPerson(organisation);
     ContactPersonTestBO contactPerson2 = CreateUnsavedContactPerson(organisation);
     ContactPersonTestBO contactPerson3 = CreateUnsavedContactPerson(organisation);
     treeViewController.LoadTreeView(organisation, 2);
     treeViewController.SetVisibility(contactPerson2, false);
     //-------------Assert Preconditions -------------
     Assert.AreEqual(1, treeView.Nodes.Count);
     ITreeNode rootNode = treeView.Nodes[0];
     Assert.AreEqual(organisation.ToString(), rootNode.Text);
     Assert.AreEqual(1, rootNode.Nodes.Count);
     ITreeNode contactPeopleNode = rootNode.Nodes[0];
     Assert.AreEqual("ContactPeople", contactPeopleNode.Text);
     Assert.AreEqual(2, contactPeopleNode.Nodes.Count);
     //---------------Execute Test ----------------------
     treeViewController.SetVisibility(contactPerson2, true);
     //---------------Test Result -----------------------
     Assert.AreEqual(1, treeView.Nodes.Count);
     Assert.AreEqual(organisation.ToString(), rootNode.Text);
     Assert.AreEqual(1, rootNode.Nodes.Count);
     Assert.AreEqual("ContactPeople", contactPeopleNode.Text);
     Assert.AreEqual(3, contactPeopleNode.Nodes.Count);
     Assert.AreEqual(treeViewController.GetBusinessObjectTreeNode(contactPerson1), contactPeopleNode.Nodes[0]);
     Assert.AreEqual(treeViewController.GetBusinessObjectTreeNode(contactPerson2), contactPeopleNode.Nodes[1]);
     Assert.AreEqual(treeViewController.GetBusinessObjectTreeNode(contactPerson3), contactPeopleNode.Nodes[2]);
 }
        public void Test_GetBusinessObjectTreeNode_ChildNode()
        {
            //---------------Set up test pack-------------------
            OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation();
            ContactPersonTestBO contactPerson = CreateUnsavedContactPerson(organisation);

            ITreeView treeView = GlobalUIRegistry.ControlFactory.CreateTreeView();
            TreeViewController treeViewController = new TreeViewController(treeView);

            treeViewController.LoadTreeView(organisation, 2);
            //-------------Assert Preconditions -------------
            Assert.AreEqual(1, treeView.Nodes.Count);
            Assert.AreEqual(1, treeView.Nodes[0].Nodes.Count);
            Assert.AreEqual(1, treeView.Nodes[0].Nodes[0].Nodes.Count);
            //---------------Execute Test ----------------------
            ITreeNode fetchedTreeNode = treeViewController.GetBusinessObjectTreeNode(contactPerson);
            //---------------Test Result -----------------------
            Assert.IsNotNull(fetchedTreeNode);
            Assert.AreSame(fetchedTreeNode, treeView.Nodes[0].Nodes[0].Nodes[0]);
        }