public void TreeView_Exp_Nodes () { // Trying to access nonexisting node. PokerTreeView tv = new PokerTreeView (); int depth = tv.Nodes[1].Depth; }
public void TreeView_Method_DataBindDataSource () { PokerTreeView tv = new PokerTreeView (); XmlDataSource xmlds = new XmlDataSource (); xmlds.EnableCaching = false; xmlds.Data = xmlDataBind; tv.DataSource = xmlds; _TreeNodeDataBoundCount = 0; tv.TreeNodeDataBound += new TreeNodeEventHandler (TreeView_TreeNodeDataBound); Assert.AreEqual (0, tv.Nodes.Count, "BeforeDataBind1"); tv.DataBind (); Assert.AreEqual (1, tv.Nodes.Count, "AfterDataBind1-a"); Assert.AreEqual ("Book", tv.Nodes[0].Text, "AfterDataBind1-b"); Assert.AreEqual (2, tv.Nodes[0].ChildNodes.Count, "AfterDataBind1-c"); Assert.AreEqual (2, tv.Nodes [0].ChildNodes [0].ChildNodes.Count, "AfterDataBind1-d"); Assert.AreEqual (6, _TreeNodeDataBoundCount, "AfterDataBind1-TreeNodeDataBoundCount"); }
public void TreeView_Exp_ImageSet () { // The specified image set is not one of the TreeViewImageSet values. PokerTreeView tv = new PokerTreeView (); tv.ImageSet = (TreeViewImageSet) 16; }
public void TreeView_Exp_ShowCheckBoxes () { // The bitwise combination value is outside the range of the TreeNodeTypes enumeration. PokerTreeView tv = new PokerTreeView (); tv.ShowCheckBoxes = (TreeNodeTypes) 8; }
public void TreeView_Method_CreateNode () { PokerTreeView tv = new PokerTreeView (); TreeNode tn = tv.CreateNodeBase (); Assert.AreEqual ("New Tree Node", tn.Text, "AfterCreateNode"); }
public void TreeView_ViewStateDataBoundNodes () { PokerTreeView b = new PokerTreeView (); SetDataBindings (b); b.DataSource = CreateXmlDataSource (); b.DataBind (); PokerTreeView copy = new PokerTreeView (); object state = b.SaveState (); copy.LoadState (state); CheckTreeNodes (copy); }
public void TreeView_Event_TreeNodePopulate () { string methodName = "TreeNodePopulate"; PokerTreeView tv = new PokerTreeView (); ResetEvents (); tv.TreeNodePopulate += new TreeNodeEventHandler (TreeViewEventHandler2); Assert.AreEqual (false, eventDone, "Before1 " + methodName); Assert.AreEqual (string.Empty, treeNodeName, "Before2 " + methodName); tv.OnTreeNodePopulateBase (new TreeNodeEventArgs (new TreeNode (methodName))); Assert.AreEqual (true, eventDone, "After1 " + methodName); Assert.AreEqual (methodName, treeNodeName, "After2 " + methodName); }
public void TreeView_Method_FindNode () { PokerTreeView tv = new PokerTreeView (); XmlDataSource xmlds = new XmlDataSource (); xmlds.EnableCaching = false; xmlds.Data = xmlDataBind; tv.DataSource = xmlds; tv.DataBind (); TreeNode tn = new TreeNode (); Assert.AreEqual (0, tn.ChildNodes.Count, "BeforeFindNode"); tn = tv.FindNode ("Book" + tv.PathSeparator + "Chapter"); Assert.AreEqual ("Chapter", tn.Text, "AfterFindNode1"); Assert.AreEqual (2, tn.ChildNodes.Count, "AfterFindNode2"); Assert.AreEqual ("Section", tn.ChildNodes[0].Text, "AfterFindNode3"); }
public void TreeView_Event_Init () { PokerTreeView tv = new PokerTreeView (); ResetEvents (); Page p = new Page (); p.Controls.Add (tv); tv.Init += new EventHandler (TreeViewEventHandler1); Assert.AreEqual (false, eventDone, "BeforeInit"); tv.OnInitBase (new EventArgs ()); Assert.AreEqual (true, eventDone, "AfterInit"); }
public void TreeView_Event_SelectedNodeChanged () { PokerTreeView tv = new PokerTreeView (); ResetEvents (); tv.SelectedNodeChanged += new EventHandler (TreeViewEventHandler1); Assert.AreEqual (false, eventDone, "BeforeSelectedNodeChanged"); tv.OnSelectedNodeChangedBase (new EventArgs ()); Assert.AreEqual (true, eventDone, "AfterSelectedNodeChanged"); }
public void Treeview_AssignToDefaultProperties () { PokerTreeView tv = new PokerTreeView (); Assert.AreEqual (0, tv.StateBag.Count, "ViewState.Count"); tv.AutoGenerateDataBindings = true; Assert.AreEqual (true, tv.AutoGenerateDataBindings, "AutoGenerateDataBindings"); Assert.AreEqual (1, tv.StateBag.Count, "ViewState.Count-1"); //tv.CheckedNodes.Add (new TreeNode ()); //Assert.AreEqual (1, tv.CheckedNodes.Count, "CheckedNodes"); //Assert.AreEqual (1, tv.StateBag.Count, "ViewState.Count-2"); tv.CollapseImageToolTip = "Collapse {0}"; Assert.AreEqual ("Collapse {0}", tv.CollapseImageToolTip, "CollapseImageToolTip"); Assert.AreEqual (2, tv.StateBag.Count, "ViewState.Count-3"); tv.CollapseImageUrl = string.Empty; Assert.AreEqual (string.Empty, tv.CollapseImageUrl, "CollapseImageUrl"); Assert.AreEqual (3, tv.StateBag.Count, "ViewState.Count-4"); tv.DataBindings.Add (new TreeNodeBinding ()); Assert.AreEqual (1, tv.DataBindings.Count, "DataBindings"); Assert.AreEqual (3, tv.StateBag.Count, "ViewState.Count-5"); tv.EnableClientScript = true; Assert.AreEqual (true, tv.EnableClientScript, "EnableClientScript"); Assert.AreEqual (4, tv.StateBag.Count, "ViewState.Count-6"); tv.ExpandDepth = -1; Assert.AreEqual (-1, tv.ExpandDepth, "ExpandDepth"); Assert.AreEqual (5, tv.StateBag.Count, "ViewState.Count-7"); tv.ExpandImageToolTip = "Expand {0}"; Assert.AreEqual ("Expand {0}", tv.ExpandImageToolTip, "ExpandImageToolTip"); Assert.AreEqual (6, tv.StateBag.Count, "ViewState.Count-8"); tv.ExpandImageUrl = string.Empty; Assert.AreEqual (string.Empty, tv.ExpandImageUrl, "ExpandImageUrl"); Assert.AreEqual (7, tv.StateBag.Count, "ViewState.Count-9"); tv.ImageSet = TreeViewImageSet.Custom; Assert.AreEqual (TreeViewImageSet.Custom, tv.ImageSet, "ImageSet"); Assert.AreEqual (8, tv.StateBag.Count, "ViewState.Count-10"); tv.LevelStyles.Add (new TreeNodeStyle ()); Assert.AreEqual (1, tv.LevelStyles.Count, "LevelStyles"); Assert.AreEqual (8, tv.StateBag.Count, "ViewState.Count-11"); tv.LineImagesFolder = string.Empty; Assert.AreEqual (string.Empty, tv.LineImagesFolder, "LineImagesFolder"); Assert.AreEqual (9, tv.StateBag.Count, "ViewState.Count-12"); tv.MaxDataBindDepth = -1; Assert.AreEqual (-1, tv.MaxDataBindDepth, "MaxDataBindDepth"); Assert.AreEqual (10, tv.StateBag.Count, "ViewState.Count-13"); tv.NodeIndent = 20; Assert.AreEqual (20, tv.NodeIndent, "NodeIndent"); Assert.AreEqual (11, tv.StateBag.Count, "ViewState.Count-14"); tv.Nodes.Add (new TreeNode ()); Assert.AreEqual (1, tv.Nodes.Count, "Nodes"); Assert.AreEqual (11, tv.StateBag.Count, "ViewState.Count-15"); tv.NodeWrap = false; Assert.AreEqual (false, tv.NodeWrap, "NodeWrap"); Assert.AreEqual (12, tv.StateBag.Count, "ViewState.Count-16"); tv.NoExpandImageUrl = string.Empty; Assert.AreEqual (string.Empty, tv.NoExpandImageUrl, "NoExpandImageUrl"); Assert.AreEqual (13, tv.StateBag.Count, "ViewState.Count-17"); tv.PopulateNodesFromClient = true; Assert.AreEqual (true, tv.PopulateNodesFromClient, "PopulateNodesFromClient"); Assert.AreEqual (14, tv.StateBag.Count, "ViewState.Count-18"); tv.ShowCheckBoxes = TreeNodeTypes.None; Assert.AreEqual (TreeNodeTypes.None, tv.ShowCheckBoxes, "ShowCheckBoxes"); Assert.AreEqual (15, tv.StateBag.Count, "ViewState.Count-19"); tv.ShowExpandCollapse = true; Assert.AreEqual (true, tv.ShowExpandCollapse, "ShowExpandCollapse"); Assert.AreEqual (16, tv.StateBag.Count, "ViewState.Count-20"); tv.ShowLines = false; Assert.AreEqual (false, tv.ShowLines, "ShowLines"); Assert.AreEqual (17, tv.StateBag.Count, "ViewState.Count-21"); tv.SkipLinkText = "Skip Navigation Links."; Assert.AreEqual ("Skip Navigation Links.", tv.SkipLinkText, "SkipLinkText"); Assert.AreEqual (18, tv.StateBag.Count, "ViewState.Count-22"); tv.Target = string.Empty; Assert.AreEqual (string.Empty, tv.Target, "Target"); Assert.AreEqual (19, tv.StateBag.Count, "ViewState.Count-23"); tv.Visible = true; Assert.AreEqual (true, tv.Visible, "Visible"); Assert.AreEqual (19, tv.StateBag.Count, "ViewState.Count-24"); }
public void TreeView_DefaultProperties () { PokerTreeView tv = new PokerTreeView (); Assert.AreEqual (0, tv.StateBag.Count, "ViewState.Count"); // Public Properties Assert.AreEqual (true, tv.AutoGenerateDataBindings, "AutoGenerateDataBindings"); Assert.AreEqual (0, tv.CheckedNodes.Count, "CheckedNodes"); Assert.AreEqual ("Collapse {0}", tv.CollapseImageToolTip, "CollapseImageToolTip"); Assert.AreEqual (string.Empty, tv.CollapseImageUrl, "CollapseImageUrl"); Assert.AreEqual (0, tv.DataBindings.Count, "DataBindings"); Assert.AreEqual (true, tv.EnableClientScript, "EnableClientScript"); Assert.AreEqual (-1, tv.ExpandDepth, "ExpandDepth"); Assert.AreEqual ("Expand {0}", tv.ExpandImageToolTip, "ExpandImageToolTip"); Assert.AreEqual (string.Empty, tv.ExpandImageUrl, "ExpandImageUrl"); Assert.AreEqual (TreeViewImageSet.Custom, tv.ImageSet, "ImageSet"); Assert.AreEqual (0, tv.LevelStyles.Count, "LevelStyles"); Assert.AreEqual (string.Empty, tv.LineImagesFolder, "LineImagesFolder"); Assert.AreEqual (-1, tv.MaxDataBindDepth, "MaxDataBindDepth"); Assert.AreEqual (20, tv.NodeIndent, "NodeIndent"); Assert.AreEqual (0, tv.Nodes.Count, "Nodes"); Assert.AreEqual (false, tv.NodeWrap, "NodeWrap"); Assert.AreEqual (string.Empty, tv.NoExpandImageUrl, "NoExpandImageUrl"); Assert.AreEqual (true, tv.PopulateNodesFromClient, "PopulateNodesFromClient"); Assert.AreEqual (null, tv.SelectedNode, "SelectedNode"); Assert.AreEqual (string.Empty, tv.SelectedValue, "SelectedValue"); Assert.AreEqual (TreeNodeTypes.None, tv.ShowCheckBoxes, "ShowCheckBoxes"); Assert.AreEqual (true, tv.ShowExpandCollapse, "ShowExpandCollapse"); Assert.AreEqual (false, tv.ShowLines, "ShowLines"); Assert.AreEqual ("Skip Navigation Links.", tv.SkipLinkText, "SkipLinkText"); Assert.AreEqual (string.Empty, tv.Target, "Target"); Assert.AreEqual (true, tv.Visible, "Visible"); // Protected Properties Assert.AreEqual (HtmlTextWriterTag.Div, tv.TagKeyFromBase, "TagKey"); }
public void TreeView_Method_PerformDataBinding () { PokerTreeView tv = new PokerTreeView (); XmlDataSource xmlds = new XmlDataSource (); xmlds.EnableCaching = false; xmlds.Data = xmlDataBind; tv.DataSource = xmlds; Assert.AreEqual (0, tv.Nodes.Count, "BeforePerformDataBinding"); tv.PerformDataBindingBase (); Assert.AreEqual (1, tv.Nodes.Count, "AfterPerformDataBinding-a"); Assert.AreEqual ("Book", tv.Nodes[0].Text, "AfterPerformDataBinding-b"); Assert.AreEqual (2, tv.Nodes[0].ChildNodes.Count, "AfterPerformDataBinding-c"); }
public void TreeView_Method_DataBindStatic () { PokerTreeView tv = new PokerTreeView (); TreeNode R = new TreeNode ("root", "value-root"); TreeNode N1 = new TreeNode ("node1", "value-node1"); TreeNode N2 = new TreeNode ("node2", "value-node2"); R.ChildNodes.Add (N1); R.ChildNodes.Add (N2); tv.Nodes.Add (R); tv.DataBind (); Assert.AreEqual (1, tv.Nodes.Count, "DataBindStatic-1"); Assert.AreEqual (2, tv.Nodes[0].ChildNodes.Count, "DataBindStatic-1"); Assert.AreEqual (0, tv.Nodes[0].ChildNodes[0].ChildNodes.Count, "DataBindStatic-2"); Assert.AreEqual ("node1", tv.Nodes[0].ChildNodes[0].Text, "DataBindStatic-3"); Assert.AreEqual ("value-node1", tv.Nodes[0].ChildNodes[0].Value, "DataBindStatic-4"); Assert.AreEqual (false, tv.Nodes[0].ChildNodes[0].DataBound, "DataBindStatic-5"); Assert.AreEqual ("", tv.Nodes[0].ChildNodes[0].DataPath, "DataBindStatic-6"); }
public void Treeview_ViewState () { PokerTreeView tv = new PokerTreeView (); tv.AutoGenerateDataBindings = true; Assert.AreEqual (true, tv.AutoGenerateDataBindings, "AutoGenerateDataBindings-beforecopy"); TreeNode node = new TreeNode (); node.Checked = true; tv.Nodes.Add (node); tv.Nodes.Add (new TreeNode ()); Assert.AreEqual (2, tv.Nodes.Count, "Nodes-beforecopy"); Assert.AreEqual (1, tv.CheckedNodes.Count, "CheckedNodes-beforecopy"); tv.CollapseImageToolTip = "Collapse {0}"; Assert.AreEqual ("Collapse {0}", tv.CollapseImageToolTip, "CollapseImageToolTip-beforecopy"); tv.CollapseImageUrl = string.Empty; Assert.AreEqual (string.Empty, tv.CollapseImageUrl, "CollapseImageUrl-beforecopy"); tv.DataBindings.Add (new TreeNodeBinding ()); Assert.AreEqual (1, tv.DataBindings.Count, "DataBindings-beforecopy"); tv.EnableClientScript = true; Assert.AreEqual (true, tv.EnableClientScript, "EnableClientScript-beforecopy"); tv.ExpandDepth = -1; Assert.AreEqual (-1, tv.ExpandDepth, "ExpandDepth-beforecopy"); tv.ExpandImageToolTip = "Expand {0}"; Assert.AreEqual ("Expand {0}", tv.ExpandImageToolTip, "ExpandImageToolTip-beforecopy"); tv.ExpandImageUrl = string.Empty; Assert.AreEqual (string.Empty, tv.ExpandImageUrl, "ExpandImageUrl-beforecopy"); tv.ImageSet = TreeViewImageSet.Custom; Assert.AreEqual (TreeViewImageSet.Custom, tv.ImageSet, "ImageSet-beforecopy"); tv.LevelStyles.Add (new TreeNodeStyle ()); Assert.AreEqual (1, tv.LevelStyles.Count, "LevelStyles-beforecopy"); tv.LineImagesFolder = string.Empty; Assert.AreEqual (string.Empty, tv.LineImagesFolder, "LineImagesFolder-beforecopy"); tv.MaxDataBindDepth = -1; Assert.AreEqual (-1, tv.MaxDataBindDepth, "MaxDataBindDepth-beforecopy"); tv.NodeIndent = 20; Assert.AreEqual (20, tv.NodeIndent, "NodeIndent-beforecopy"); tv.NodeWrap = false; Assert.AreEqual (false, tv.NodeWrap, "NodeWrap-beforecopy"); tv.NoExpandImageUrl = string.Empty; Assert.AreEqual (string.Empty, tv.NoExpandImageUrl, "NoExpandImageUrl-beforecopy"); tv.PopulateNodesFromClient = true; Assert.AreEqual (true, tv.PopulateNodesFromClient, "PopulateNodesFromClient-beforecopy"); tv.ShowCheckBoxes = TreeNodeTypes.None; Assert.AreEqual (TreeNodeTypes.None, tv.ShowCheckBoxes, "ShowCheckBoxes-beforecopy"); tv.ShowExpandCollapse = true; Assert.AreEqual (true, tv.ShowExpandCollapse, "ShowExpandCollapse-beforecopy"); tv.ShowLines = false; Assert.AreEqual (false, tv.ShowLines, "ShowLines-beforecopy"); tv.SkipLinkText = "Skip Navigation Links."; Assert.AreEqual ("Skip Navigation Links.", tv.SkipLinkText, "SkipLinkText-beforecopy"); tv.Target = string.Empty; Assert.AreEqual (string.Empty, tv.Target, "Target-beforecopy"); tv.Visible = true; Assert.AreEqual (true, tv.Visible, "Visible-beforecopy"); object state = tv.SaveState (); PokerTreeView copy = new PokerTreeView (); copy.LoadState (state); Assert.AreEqual (true, copy.AutoGenerateDataBindings, "AutoGenerateDataBindings-aftercopy"); Assert.AreEqual ("Collapse {0}", copy.CollapseImageToolTip, "CollapseImageToolTip-aftercopy"); Assert.AreEqual (string.Empty, copy.CollapseImageUrl, "CollapseImageUrl-aftercopy"); Assert.AreEqual (true, copy.EnableClientScript, "EnableClientScript-aftercopy"); Assert.AreEqual (-1, copy.ExpandDepth, "ExpandDepth-aftercopy"); Assert.AreEqual ("Expand {0}", copy.ExpandImageToolTip, "ExpandImageToolTip-aftercopy"); Assert.AreEqual (string.Empty, copy.ExpandImageUrl, "ExpandImageUrl-aftercopy"); Assert.AreEqual (TreeViewImageSet.Custom, copy.ImageSet, "ImageSet-aftercopy"); Assert.AreEqual (1, copy.LevelStyles.Count, "LevelStyles-aftercopy"); Assert.AreEqual (string.Empty, copy.LineImagesFolder, "LineImagesFolder-aftercopy"); Assert.AreEqual (-1, copy.MaxDataBindDepth, "MaxDataBindDepth-aftercopy"); Assert.AreEqual (20, copy.NodeIndent, "NodeIndent-aftercopy"); Assert.AreEqual (2, copy.Nodes.Count, "Nodes-aftercopy"); Assert.AreEqual (false, copy.NodeWrap, "NodeWrap-aftercopy"); Assert.AreEqual (string.Empty, copy.NoExpandImageUrl, "NoExpandImageUrl-aftercopy"); Assert.AreEqual (true, copy.PopulateNodesFromClient, "PopulateNodesFromClient-aftercopy"); Assert.AreEqual (TreeNodeTypes.None, copy.ShowCheckBoxes, "ShowCheckBoxes-aftercopy"); Assert.AreEqual (true, copy.ShowExpandCollapse, "ShowExpandCollapse-aftercopy"); Assert.AreEqual (false, copy.ShowLines, "ShowLines-aftercopy"); Assert.AreEqual ("Skip Navigation Links.", copy.SkipLinkText, "SkipLinkText-aftercopy"); Assert.AreEqual (string.Empty, copy.Target, "Target-aftercopy"); Assert.AreEqual (true, copy.Visible, "Visible-aftercopy"); }
public void TreeView_Method_DataBind () { PokerTreeView tv = new PokerTreeView (); SetDataBindings (tv); tv.DataSource = CreateXmlDataSource (); tv.DataBind (); CheckTreeNodes (tv); }
public void TreeView_ViewStateNodes () { PokerTreeView tv = new PokerTreeView (); TreeNode R = new TreeNode ("root", "value-root"); TreeNode N1 = new TreeNode ("node1", "value-node1"); TreeNode N2 = new TreeNode ("node2", "value-node2"); R.ChildNodes.Add (N1); R.ChildNodes.Add (N2); tv.Nodes.Add (R); PokerTreeView copy = new PokerTreeView (); object state = tv.SaveState (); copy.LoadState (state); Assert.AreEqual (1, tv.Nodes.Count, "ViewStateNodes-1"); Assert.AreEqual (2, tv.Nodes[0].ChildNodes.Count, "ViewStateNodes-1"); Assert.AreEqual (0, tv.Nodes[0].ChildNodes[0].ChildNodes.Count, "ViewStateNodes-2"); Assert.AreEqual ("node1", tv.Nodes[0].ChildNodes[0].Text, "ViewStateNodes-3"); Assert.AreEqual ("value-node1", tv.Nodes[0].ChildNodes[0].Value, "ViewStateNodes-4"); Assert.AreEqual (false, tv.Nodes[0].ChildNodes[0].DataBound, "ViewStateNodes-5"); Assert.AreEqual ("", tv.Nodes[0].ChildNodes[0].DataPath, "ViewStateNodes-6"); }
public void TreeNodeCollection_ViewState () { PokerTreeView orig = new PokerTreeView (); orig.DoTrackViewState (); BuildTree (orig); PokerTreeView copy = new PokerTreeView (); copy.DoTrackViewState (); object state = orig.DoSaveViewState (); copy.DoLoadViewState (state); // restored collection that was created after TrackViewState Assert.AreEqual (1, copy.Nodes.Count, "TreeNodeCollection_ViewState#1"); Assert.AreEqual (2, copy.Nodes [0].ChildNodes.Count, "TreeNodeCollection_ViewState#2"); Assert.AreEqual (0, copy.Nodes [0].ChildNodes [0].ChildNodes.Count, "TreeNodeCollection_ViewState#3"); Assert.AreEqual ("node1", copy.Nodes [0].ChildNodes [0].Text, "TreeNodeCollection_ViewState#4"); Assert.AreEqual ("value-node1", copy.Nodes [0].ChildNodes [0].Value, "TreeNodeCollection_ViewState#5"); Assert.AreEqual (false, copy.Nodes [0].ChildNodes [0].DataBound, "TreeNodeCollection_ViewState#6"); Assert.AreEqual ("", copy.Nodes [0].ChildNodes [0].DataPath, "TreeNodeCollection_ViewState#7"); PokerTreeView orig2 = new PokerTreeView (); BuildTree (orig2); orig2.DoTrackViewState (); orig2.Nodes [0].ChildNodes [0].Text = "changed text 1"; orig2.Nodes [0].ChildNodes [0].Value = "changed value 1"; PokerTreeView copy2 = new PokerTreeView (); BuildTree (copy2); copy2.DoTrackViewState (); object state2 = orig2.DoSaveViewState (); copy2.DoLoadViewState (state2); // restored collection that was changed (item's properties only) after TrackViewState Assert.AreEqual (1, copy2.Nodes.Count, "TreeNodeCollection_ViewState#8"); Assert.AreEqual (2, copy2.Nodes [0].ChildNodes.Count, "TreeNodeCollection_ViewState#9"); Assert.AreEqual (0, copy2.Nodes [0].ChildNodes [0].ChildNodes.Count, "TreeNodeCollection_ViewState#10"); Assert.AreEqual ("changed text 1", copy2.Nodes [0].ChildNodes [0].Text, "TreeNodeCollection_ViewState#11"); Assert.AreEqual ("changed value 1", copy2.Nodes [0].ChildNodes [0].Value, "TreeNodeCollection_ViewState#12"); Assert.AreEqual (false, copy2.Nodes [0].ChildNodes [0].DataBound, "TreeNodeCollection_ViewState#13"); Assert.AreEqual ("", copy2.Nodes [0].ChildNodes [0].DataPath, "TreeNodeCollection_ViewState#14"); PokerTreeView orig3 = new PokerTreeView (); BuildTree (orig3); orig3.DoTrackViewState (); orig3.Nodes [0].ChildNodes [0].Text = "changed text 1"; orig3.Nodes [0].ChildNodes [0].Value = "changed value 1"; orig3.Nodes [0].ChildNodes.RemoveAt (1); PokerTreeView copy3 = new PokerTreeView (); BuildTree (copy3); copy3.DoTrackViewState (); object state3 = orig3.DoSaveViewState (); copy3.DoLoadViewState (state3); // restored collection that was changed after TrackViewState Assert.AreEqual (1, copy3.Nodes.Count, "TreeNodeCollection_ViewState#15"); Assert.AreEqual (1, copy3.Nodes [0].ChildNodes.Count, "TreeNodeCollection_ViewState#16"); Assert.AreEqual (0, copy3.Nodes [0].ChildNodes [0].ChildNodes.Count, "TreeNodeCollection_ViewState#17"); Assert.AreEqual ("changed text 1", copy3.Nodes [0].ChildNodes [0].Text, "TreeNodeCollection_ViewState#18"); Assert.AreEqual ("changed value 1", copy3.Nodes [0].ChildNodes [0].Value, "TreeNodeCollection_ViewState#19"); Assert.AreEqual (false, copy3.Nodes [0].ChildNodes [0].DataBound, "TreeNodeCollection_ViewState#20"); Assert.AreEqual ("", copy3.Nodes [0].ChildNodes [0].DataPath, "TreeNodeCollection_ViewState#21"); }
public void TreeView_Method_CreateControlCollection () { PokerTreeView tv = new PokerTreeView (); ControlCollection cc = tv.CreateControlCollectionBase (); Assert.AreEqual (0, cc.Count, "AfterCreateControlCollection"); }