コード例 #1
0
		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");
		}
コード例 #2
0
		public void TreeView_Method_DataBind () {
			PokerTreeView tv = new PokerTreeView ();
			SetDataBindings (tv);
			tv.DataSource = CreateXmlDataSource ();
			tv.DataBind ();
			CheckTreeNodes (tv);
		}
コード例 #3
0
		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");
		}
コード例 #4
0
		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");
		}
コード例 #5
0
		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);
		}