// All this methods are delegates for running tests in host assembly. public static void _DefaultRender (Page p) { LiteralControl lcb = new LiteralControl (HtmlDiff.BEGIN_TAG); LiteralControl lce = new LiteralControl (HtmlDiff.END_TAG); Menu menu = new MenuTable (); p.Form.Controls.Add (lcb); p.Form.Controls.Add (menu); p.Form.Controls.Add (lce); }
public void Menu_DataBindings () { Menu m = new MenuTable (); SetDataBindings (m); m.DataSource = CreateXmlDataSource (); m.DataBind (); CheckMenuItems (m); }
static Menu CreateMenu () { Menu m = new MenuTable (); MenuItem rootItem = new MenuItem ("RootItem-Text", "RootItem-Value"); m.Items.Add (rootItem); rootItem.ChildItems.Add (new MenuItem ("Node1-Text", "Node1-Value")); rootItem.ChildItems.Add (new MenuItem ("Node2-Text", "Node2-Value")); m.StaticItemTemplate = new CompiledTemplateBuilder (_StaticItemTemplate); m.DynamicItemTemplate = new CompiledTemplateBuilder (_DynamicItemTemplate); return m; }
public void MenuItemCollection5 () { Menu m = new MenuTable (); ((IStateManager) m.Items).TrackViewState (); fillMenu (m); object state = ((IStateManager) m.Items).SaveViewState (); Menu copy = new MenuTable (); ((IStateManager) copy.Items).TrackViewState (); ((IStateManager) copy.Items).LoadViewState (state); Assert.AreEqual (1, copy.Items.Count); Assert.AreEqual (2, copy.Items [0].ChildItems.Count); Assert.AreEqual (1, copy.Items [0].ChildItems [0].ChildItems.Count); }
public void MenuItemCollection4 () { Menu m = new MenuTable (); fillMenu (m); m.Items.Add (new MenuItem ("root 2")); m.Items [0].ChildItems.RemoveAt (1); ((IStateManager) m.Items).TrackViewState (); m.Items [0].Text = "root"; m.Items [0].ChildItems [0].Text = "node"; m.Items [0].ChildItems [0].ChildItems [0].Text = "subnode"; object state = ((IStateManager) m.Items).SaveViewState (); Menu copy = new MenuTable (); fillMenu (copy); copy.Items.Add (new MenuItem ("root 2")); copy.Items [0].ChildItems.RemoveAt (1); ((IStateManager) copy.Items).TrackViewState (); ((IStateManager) copy.Items).LoadViewState (state); Assert.AreEqual (2, copy.Items.Count); Assert.AreEqual (1, copy.Items [0].ChildItems.Count); Assert.AreEqual (1, copy.Items [0].ChildItems [0].ChildItems.Count); Assert.AreEqual ("root", copy.Items [0].Text); Assert.AreEqual ("node", copy.Items [0].ChildItems [0].Text); Assert.AreEqual ("subnode", copy.Items [0].ChildItems [0].ChildItems [0].Text); }
public static void PostBackFireEvents_Init (Page p) { Menu_SetTableMode (p); Menu m = new MenuTable (); m.MenuItemDataBound += new MenuEventHandler (MenuItemDataBound_Event); m.DataSource = LoadXml (); p.Controls.Add (m); m.DataBind (); }