SetVisibility() public method

Set the visibility for the node associated with a particular business object in the tree view.
public SetVisibility ( IBusinessObject businessObject, bool visible ) : void
businessObject IBusinessObject
visible bool
return void
 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_SetBusinessObjectVisibility_True_ShouldShowNode()
     {
         //---------------Set up test pack-------------------
         ITreeView treeView = GlobalUIRegistry.ControlFactory.CreateTreeView();
         TreeViewController treeViewController = new TreeViewController(treeView);
         OrganisationTestBO organisation = OrganisationTestBO.CreateSavedOrganisation();
         ContactPersonTestBO contactPerson = CreateUnsavedContactPerson(organisation);
 
         treeViewController.LoadTreeView(organisation, 2);
         //-------------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 relationshipNode = rootNode.Nodes[0];
         Assert.AreEqual("ContactPeople", relationshipNode.Text);
         Assert.AreEqual(1, relationshipNode.Nodes.Count);
         ITreeNode childNode = relationshipNode.Nodes[0];
         Assert.AreEqual(contactPerson.ToString(), childNode.Text);
         //---------------Execute Test ----------------------
         treeViewController.SetVisibility(contactPerson, true);
         //---------------Test Result -----------------------
         Assert.AreEqual(1, treeView.Nodes.Count);
         Assert.AreEqual(organisation.ToString(), rootNode.Text);
         Assert.AreEqual(1, rootNode.Nodes.Count);
         Assert.AreEqual("ContactPeople", relationshipNode.Text);
         Assert.AreEqual(1, relationshipNode.Nodes.Count);
     }