public void DetailsView_Events () { ResetEvents (); PokerDetailsView dv = new PokerDetailsView (); Button bt = new Button (); Page pg = new Page (); dv.Page = pg; dv.Init += new EventHandler (dv_Init); dv.ItemCommand += new DetailsViewCommandEventHandler (dv_ItemCommand); dv.ItemCreated += new EventHandler (dv_ItemCreated); dv.ItemDeleted += new DetailsViewDeletedEventHandler (dv_ItemDeleted); dv.ItemDeleting += new DetailsViewDeleteEventHandler (dv_ItemDeleting); dv.ItemInserted += new DetailsViewInsertedEventHandler (dv_ItemInserted); dv.ItemInserting += new DetailsViewInsertEventHandler (dv_ItemInserting); dv.ItemUpdated += new DetailsViewUpdatedEventHandler (dv_ItemUpdated); dv.ItemUpdating += new DetailsViewUpdateEventHandler (dv_ItemUpdating); dv.ModeChanged += new EventHandler (dv_ModeChanged); dv.ModeChanging += new DetailsViewModeEventHandler (dv_ModeChanging); dv.PageIndexChanged += new EventHandler (dv_PageIndexChanged); dv.PageIndexChanging += new DetailsViewPageEventHandler (dv_PageIndexChanging); dv.DataBound += new EventHandler (dv_DataBound); dv.PreRender += new EventHandler (dv_PreRender); dv.Unload += new EventHandler (dv_Unload); Assert.AreEqual (false, init, "BeforeInit"); dv.DoOnInit (new EventArgs ()); Assert.AreEqual (true, init, "AfterInit"); Assert.AreEqual (false, itemCommand, "BeforeItemCommand"); dv.DoOnItemCommand (new DetailsViewCommandEventArgs (bt,new CommandEventArgs ("",null))); Assert.AreEqual (true, itemCommand , "AfterItemCommand"); Assert.AreEqual (false, itemCreated, "BeforeItemCreated"); dv.DoOnItemCreated (new EventArgs ()); Assert.AreEqual (true, itemCreated, "AfterItemCreated"); Assert.AreEqual (false, itemDeleted, "BeforeItemDeleted"); dv.DoOnItemDeleted (new DetailsViewDeletedEventArgs (3, new Exception ())); Assert.AreEqual (true, itemDeleted, "AfterItemDeleted"); Assert.AreEqual (false, itemDeleting, "BeforeItemDeleting"); dv.DoOnItemDeleting(new DetailsViewDeleteEventArgs (2)); Assert.AreEqual (true, itemDeleting, "AfterItemDeleting"); Assert.AreEqual (false, itemInserted, "BeforeItemInserted"); dv.DoOnItemInserted (new DetailsViewInsertedEventArgs (3,new Exception())); Assert.AreEqual (true, itemInserted, "AfterItemInserted"); Assert.AreEqual (false, itemInserting, "BeforeItemInserting"); dv.DoOnItemInserting (new DetailsViewInsertEventArgs (bt)); Assert.AreEqual (true, itemInserting, "AfterItemInserting"); Assert.AreEqual (false, itemUpdated, "BeforeItemUpdated"); dv.DoOnItemUpdated (new DetailsViewUpdatedEventArgs (2,new Exception())); Assert.AreEqual (true, itemUpdated, "AfterItemUpdated"); Assert.AreEqual (false, itemUpdating, "BeforeItemUpdating"); dv.DoOnItemUpdating (new DetailsViewUpdateEventArgs (bt)); Assert.AreEqual (true, itemUpdating, "AfterItemUpdating"); Assert.AreEqual (false, modeChanged, "BeforeModeChanged"); dv.DoOnModeChanged (new EventArgs ()); Assert.AreEqual (true, modeChanged, "AfterModeChanged"); Assert.AreEqual (false, modeChanging, "BeforeModeChanging"); dv.DoOnModeChanging (new DetailsViewModeEventArgs (DetailsViewMode.Insert ,false)); Assert.AreEqual (true, modeChanging, "AfterModeChanging"); Assert.AreEqual (false, pageIndexChanged, "BeforePageIndexChanged"); dv.DoOnPageIndexChanged (new EventArgs ()); Assert.AreEqual (true, pageIndexChanged, "AfterPageIndexChanged"); Assert.AreEqual (false, pageIndexChanging, "BeforePageIndexChanging"); dv.DoOnPageIndexChanging (new DetailsViewPageEventArgs (2)); Assert.AreEqual (true, pageIndexChanging, "AfterPageIndexChanging"); //Assert.AreEqual (false, pagePreLoad, "BeforePagePreLoad"); //dv.DoOnPagePreLoad (pg, new EventArgs ()); //Assert.AreEqual (true, pagePreLoad, "AfterPagePreLoad"); Assert.AreEqual (false, preRender, "BeforePreRender"); dv.DoOnPreRender(new EventArgs ()); Assert.AreEqual (true, preRender, "AfterPreRender"); Assert.AreEqual (false, unload, "BeforeUnload"); dv.DoOnUnload (new EventArgs ()); Assert.AreEqual (true, unload, "AfterUnload"); //Assert.AreEqual (false, dataSourceViewChanged, "BeforeDataSourceViewChanged"); //dv.DoOnDataSourceViewChanged (bt, new EventArgs ()); //Assert.AreEqual (true, dataSourceViewChanged, "AfterDataSourceViewChanged"); }
public void DetailsView_EnsureDataBound () { ObjectDataSource ds = new ObjectDataSource (); ds.ID = "ObjectDataSource1"; ds.TypeName = "System.Guid"; ds.SelectMethod = "ToByteArray"; Page p = new Page (); PokerDetailsView dv = new PokerDetailsView (); dv.Page = p; ds.Page = p; p.Controls.Add (dv); p.Controls.Add (ds); dv.DataSourceID = "ObjectDataSource1"; Assert.AreEqual (false, dv.ensureDataBound, "BeforeEnsureDataBound"); dv.DoConfirmInitState (); dv.DoOnPreRender (EventArgs.Empty); Assert.AreEqual (true, dv.ensureDataBound, "AfterEnsureDataBound"); }