本文整理汇总了C#中MonoTests.System.Web.UI.WebControls.TestDataList类的典型用法代码示例。如果您正苦于以下问题:C# TestDataList类的具体用法?C# TestDataList怎么用?C# TestDataList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestDataList类属于MonoTests.System.Web.UI.WebControls命名空间,在下文中一共展示了TestDataList类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Events
public void Events ()
{
TestDataList dl = new TestDataList ();
DataListCommandEventArgs command_args = new DataListCommandEventArgs (null,
null, new CommandEventArgs (String.Empty, String.Empty));
DataListItemEventArgs item_args = new DataListItemEventArgs (null);
ResetEvents ();
dl.CancelCommand += new DataListCommandEventHandler (CancelCommandHandler);
dl.DoCancelCommand (command_args);
Assert.IsTrue (cancelCommandEvent, "cancelCommandEvent");
ResetEvents ();
dl.DeleteCommand += new DataListCommandEventHandler (DeleteCommandHandler);
dl.DoDeleteCommand (command_args);
Assert.IsTrue (deleteCommandEvent, "deleteCommandEvent");
ResetEvents ();
dl.EditCommand += new DataListCommandEventHandler (EditCommandHandler);
dl.DoEditCommand (command_args);
Assert.IsTrue (editCommandEvent, "editCommandEvent");
ResetEvents ();
dl.ItemCommand += new DataListCommandEventHandler (ItemCommandHandler);
dl.DoItemCommand (command_args);
Assert.IsTrue (itemCommandEvent, "itemCommandEvent");
ResetEvents ();
dl.ItemCreated += new DataListItemEventHandler (ItemCreatedHandler);
dl.DoItemCreated (item_args);
Assert.IsTrue (itemCreatedEvent, "itemCreatedEvent");
ResetEvents ();
dl.ItemDataBound += new DataListItemEventHandler (ItemDataBoundHandler);
dl.DoItemDataBound (item_args);
Assert.IsTrue (itemDataBoundEvent, "itemDataBoundEvent");
ResetEvents ();
dl.UpdateCommand += new DataListCommandEventHandler (UpdateCommandHandler);
dl.DoUpdateCommand (command_args);
Assert.IsTrue (updateCommandEvent, "updateCommandEvent");
ResetEvents ();
dl.SelectedIndexChanged += new EventHandler (SelectedIndexChangedHandler);
dl.DoSelectedIndexChanged (new EventArgs ());
Assert.IsTrue (selectedIndexChangedEvent, "selectedIndexChangedEvent");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:47,代码来源:DataListTest.cs
示例2: NControls2
public void NControls2 ()
{
TestDataList dl = new TestDataList ();
dl.ShowHeader = true;
dl.ShowFooter = true;
dl.DataSource = GetData (5);
dl.CreateCH ();
Assert.AreEqual (5, dl.Controls.Count, "#01");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:9,代码来源:DataListTest.cs
示例3: SaveViewState
public void SaveViewState ()
{
TestDataList dl = new TestDataList ();
dl.TrackState ();
object[] vs = (object[]) dl.SaveState ();
#if NET_2_0
Assert.AreEqual (9, vs.Length, "Size");
#else
Assert.AreEqual (8, vs.Length, "Size");
#endif
// By default the viewstate is all null
int i = 0;
for (; i < vs.Length; i++)
Assert.IsNull (vs [i], "Empty-" + i);
i = 0;
#if NET_2_0
i++;
#else
dl.GridLines = GridLines.Vertical;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "GridLines");
#endif
dl.ItemStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "ItemStyle");
dl.SelectedItemStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "SelectedItemStyle");
dl.AlternatingItemStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "AlternatingItemStyle");
dl.EditItemStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "EditItemStyle");
dl.SeparatorStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "SeparatorStyle");
dl.HeaderStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "HeaderStyle");
dl.FooterStyle.HorizontalAlign = HorizontalAlign.Center;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "FooterStyle");
#if NET_2_0
// GridLines was moved last
dl.GridLines = GridLines.Vertical;
vs = (object []) dl.SaveState ();
Assert.IsNotNull (vs[i++], "GridLines");
#endif
}
开发者ID:whereisaaron,项目名称:mono,代码行数:58,代码来源:DataListTest.cs
示例4: SelectedValue_WithoutDataKeyField
public void SelectedValue_WithoutDataKeyField ()
{
TestDataList dl = new TestDataList ();
Assert.IsNull (dl.SelectedValue, "SelectedValue");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:5,代码来源:DataListTest.cs
示例5: EditItemIndexTooLow
public void EditItemIndexTooLow ()
{
TestDataList dl = new TestDataList ();
dl.EditItemIndex = -2;
}
开发者ID:whereisaaron,项目名称:mono,代码行数:5,代码来源:DataListTest.cs
示例6: SelectIndexOutOfRange
public void SelectIndexOutOfRange ()
{
TestDataList dl = new TestDataList ();
// No exception is thrown
dl.SelectedIndex = 25;
}
开发者ID:whereisaaron,项目名称:mono,代码行数:6,代码来源:DataListTest.cs
示例7: RepeatInfo2
public void RepeatInfo2 ()
{
TestDataList dl = new TestDataList ();
dl.ShowHeader = true;
dl.HeaderTemplate = new Templ ();
dl.ShowFooter = true;
dl.FooterTemplate = new Templ ();
dl.SeparatorTemplate = new Templ ();
dl.DataSource = GetData (6);
dl.CreateCH ();
IRepeatInfoUser repeater = (IRepeatInfoUser) dl;
Style style = repeater.GetItemStyle (ListItemType.Pager, -1);
Assert.IsNull (style, "#01");
style = repeater.GetItemStyle (ListItemType.Pager, 0);
Assert.IsNull (style, "#02");
style = repeater.GetItemStyle (ListItemType.Pager, 15);
Assert.IsNull (style, "#03");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:18,代码来源:DataListTest.cs
示例8: GetItemStyle_Pager_Empty
public void GetItemStyle_Pager_Empty ()
{
TestDataList dl = new TestDataList ();
IRepeatInfoUser riu = (dl as IRepeatInfoUser);
// Pager isn't supported in DataList
Assert.IsNull (riu.GetItemStyle (ListItemType.Pager, 0), "Pager-0");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:7,代码来源:DataListTest.cs
示例9: NControls6
public void NControls6 ()
{
TestDataList dl = new TestDataList ();
dl.ShowHeader = true;
dl.HeaderTemplate = new Templ ();
dl.ShowFooter = true;
dl.FooterTemplate = new Templ ();
dl.SeparatorTemplate = new Templ ();
dl.DataSource = GetData (6);
dl.CreateCH ();
Assert.AreEqual (14, dl.Controls.Count, "#01");
Assert.AreEqual (ListItemType.Header, ((DataListItem) dl.Controls [0]).ItemType, "#02");
for (int i = 0; i < 3; i++) {
int b = (i * 4) + 1;
DataListItem one = (DataListItem) dl.Controls [b];
DataListItem two = (DataListItem) dl.Controls [b + 1];
DataListItem three = (DataListItem) dl.Controls [b + 2];
DataListItem four = (DataListItem) dl.Controls [b + 3];
Assert.AreEqual (ListItemType.Item, one.ItemType, String.Format ("#02-{0}", b));
Assert.AreEqual (ListItemType.Separator, two.ItemType, String.Format ("#02-{0}", b + 1));
Assert.AreEqual (ListItemType.AlternatingItem, three.ItemType, String.Format ("#02-{0}", b + 2));
Assert.AreEqual (ListItemType.Separator, four.ItemType, String.Format ("#02-{0}", b + 3));
}
Assert.AreEqual (ListItemType.Footer, ((DataListItem) dl.Controls [13]).ItemType, "#03");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:27,代码来源:DataListTest.cs
示例10: RepeatInfo1
public void RepeatInfo1 ()
{
TestDataList dl = new TestDataList ();
dl.ShowHeader = true;
dl.HeaderTemplate = new Templ ();
dl.ShowFooter = true;
dl.FooterTemplate = new Templ ();
dl.SeparatorTemplate = new Templ ();
dl.DataSource = GetData (6);
dl.CreateCH ();
IRepeatInfoUser repeater = (IRepeatInfoUser) dl;
Assert.AreEqual (true, repeater.HasHeader, "#01");
Assert.AreEqual (true, repeater.HasFooter, "#02");
Assert.AreEqual (true, repeater.HasSeparators, "#03");
Assert.AreEqual (6, repeater.RepeatedItemCount, "#04");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:16,代码来源:DataListTest.cs
示例11: DataSourceID
public void DataSourceID ()
{
Page p = new Page();
ObjectDataSource ds = new ObjectDataSource();
ds.ID = "ObjectDataSource1";
ds.TypeName = "System.Guid";
ds.SelectMethod = "ToByteArray";
TestDataList dl = new TestDataList ();
dl.Page = p;
ds.Page = p;
p.Controls.Add(dl);
p.Controls.Add(ds);
dl.DataSourceID = "ObjectDataSource1";
dl.CreateCH ();
Assert.AreEqual (16, dl.Controls.Count, "#01");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:16,代码来源:DataListTest.cs
示例12: NControls5
public void NControls5 ()
{
TestDataList dl = new TestDataList ();
dl.ShowHeader = true;
dl.HeaderTemplate = new Templ ();
dl.SeparatorTemplate = new Templ ();
dl.DataSource = GetData (5);
dl.CreateCH ();
Assert.AreEqual (11, dl.Controls.Count, "#01");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:10,代码来源:DataListTest.cs
示例13: ProperTemplateSelectedIndexEqualsEditIndex
public void ProperTemplateSelectedIndexEqualsEditIndex ()
{
TestDataList dl = new TestDataList();
dl.ItemTemplate = new ItemTemplate();
dl.AlternatingItemTemplate = new ItemTemplate();
dl.SelectedItemTemplate = new ItemTemplate();
dl.EditItemTemplate = new EditItemTemplate();
dl.DataSource = GetData(5);
dl.SelectedIndex = 0;
dl.EditItemIndex = 0;
dl.DataBind();
object canIGetMyEditItem = dl.Items[dl.EditItemIndex].FindControl("eitemtmpl");
Assert.IsTrue(canIGetMyEditItem != null, "ProperTemplateSelectedIndexEqualsEditIndex");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:14,代码来源:DataListTest.cs
示例14: GetItemStyle_Separator_Empty
public void GetItemStyle_Separator_Empty ()
{
TestDataList dl = new TestDataList ();
IRepeatInfoUser riu = (dl as IRepeatInfoUser);
// empty list/controls
riu.GetItemStyle (ListItemType.Separator, 0);
}
开发者ID:whereisaaron,项目名称:mono,代码行数:7,代码来源:DataListTest.cs
示例15: RepeatInfo3
public void RepeatInfo3 ()
{
TestDataList dl = new TestDataList ();
dl.ShowHeader = true;
dl.HeaderTemplate = new Templ ();
dl.ShowFooter = true;
dl.FooterTemplate = new Templ ();
dl.SeparatorTemplate = new Templ ();
dl.DataSource = GetData (6);
dl.CreateCH ();
IRepeatInfoUser repeater = (IRepeatInfoUser) dl;
Style style = repeater.GetItemStyle (ListItemType.Header, -1);
DataListItem header = (DataListItem) dl.Controls [0];
Assert.IsNull (style, "#01");
style = repeater.GetItemStyle (ListItemType.Footer, -1);
DataListItem footer = (DataListItem) dl.Controls [13];
Assert.IsNull (style, "#02");
for (int i = 0; i < 6; i++) {
style = repeater.GetItemStyle (ListItemType.Item, i);
Assert.IsNull (style, String.Format ("#02-{0}", i));
}
}
开发者ID:whereisaaron,项目名称:mono,代码行数:23,代码来源:DataListTest.cs
示例16: GetItemStyle_Separator
public void GetItemStyle_Separator ()
{
TestDataList dl = new TestDataList ();
dl.DataSource = GetData (6);
dl.DataBind ();
IRepeatInfoUser riu = (dl as IRepeatInfoUser);
Assert.IsNull (riu.GetItemStyle (ListItemType.Separator, 0));
}
开发者ID:whereisaaron,项目名称:mono,代码行数:8,代码来源:DataListTest.cs
示例17: RepeatInfo4
public void RepeatInfo4 ()
{
TestDataList dl = new TestDataList ();
dl.DataSource = GetData (6);
dl.ItemStyle.ForeColor = Color.Blue;
dl.CreateCH ();
dl.PrepareCH (); // removing this causes all the GetItemStyle calls to return null
IRepeatInfoUser repeater = (IRepeatInfoUser) dl;
for (int i = 0; i < 6; i++) {
Style style = repeater.GetItemStyle (ListItemType.Item, i);
DataListItem item = (DataListItem) dl.Controls [i];
Assert.AreEqual (style, item.ControlStyle, String.Format ("#01-{0}", i));
}
}
开发者ID:whereisaaron,项目名称:mono,代码行数:14,代码来源:DataListTest.cs
示例18: Controls
public void Controls ()
{
TestDataList dl = new TestDataList ();
Assert.AreEqual (0, dl.Controls.Count, "Controls-1");
Assert.AreEqual (0, dl.Items.Count, "Items-1");
dl.DataSource = GetDataSource (3);
Assert.AreEqual (0, dl.Controls.Count, "Controls-2");
Assert.AreEqual (0, dl.Items.Count, "Items-2");
dl.DataBind ();
Assert.AreEqual (0, dl.Controls.Count, "Controls-3");
Assert.AreEqual (0, dl.Items.Count, "Items-3");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:12,代码来源:DataListTest.cs
示例19: DefaultProperties
public void DefaultProperties ()
{
TestDataList dl = new TestDataList ();
CheckIRepeatInfoUser (dl);
#if NET_2_0
Assert.AreEqual ("table", dl.Tag, "TagName");
#else
Assert.AreEqual ("span", dl.Tag, "TagName");
#endif
Assert.AreEqual (0, dl.Attributes.Count, "Attributes.Count-1");
Assert.AreEqual (0, dl.StateBag.Count, "ViewState.Count-1");
// Styles
Assert.IsNotNull (dl.AlternatingItemStyle, "AlternatingItemStyle");
Assert.IsNotNull (dl.EditItemStyle, "EditItemStyle");
Assert.IsNotNull (dl.FooterStyle, "FooterStyle");
Assert.IsNotNull (dl.HeaderStyle, "HeaderStyle");
Assert.IsNotNull (dl.ItemStyle, "ItemStyle");
Assert.IsNotNull (dl.SelectedItemStyle, "SelectedItemStyle");
Assert.IsNotNull (dl.SeparatorStyle, "SeparatorStyle");
// Templates
Assert.IsNull (dl.AlternatingItemTemplate, "AlternatingItemTemplate");
Assert.IsNull (dl.EditItemTemplate, "EditItemTemplate");
Assert.IsNull (dl.FooterTemplate, "FooterTemplate");
Assert.IsNull (dl.HeaderTemplate, "HeaderTemplate");
Assert.IsNull (dl.ItemTemplate, "ItemTemplate");
Assert.IsNull (dl.SelectedItemTemplate, "SelectedItemTemplate");
Assert.IsNull (dl.SeparatorTemplate, "SeparatorTemplate");
// Indexes
Assert.AreEqual (-1, dl.EditItemIndex, "EditItemIndex");
Assert.AreEqual (-1, dl.SelectedIndex, "SelectedIndex");
// others (from DataList)
Assert.IsFalse (dl.ExtractTemplateRows, "ExtractTemplateRows");
Assert.AreEqual (0, dl.Items.Count, "Items.Count");
Assert.AreEqual (0, dl.RepeatColumns, "RepeatColumns");
Assert.AreEqual (RepeatDirection.Vertical, dl.RepeatDirection, "RepeatDirection");
Assert.AreEqual (RepeatLayout.Table, dl.RepeatLayout, "RepeatLayout");
Assert.IsNull (dl.SelectedItem, "SelectedItem");
Assert.IsTrue (dl.ShowFooter, "ShowFooter");
Assert.IsTrue (dl.ShowHeader, "ShowHeader");
// the CellPadding, CellSpacing, GridLines and HorizontalAlign are defined
// in BaseDataList but couldn't be totally tested from there
Assert.AreEqual (-1, dl.CellPadding, "CellPadding");
Assert.AreEqual (0, dl.CellSpacing, "CellSpacing");
#if NET_2_0
Assert.AreEqual (GridLines.None, dl.GridLines, "GridLines");
#else
Assert.AreEqual (GridLines.Both, dl.GridLines, "GridLines");
#endif
Assert.AreEqual (HorizontalAlign.NotSet, dl.HorizontalAlign, "HorizontalAlign");
Assert.AreEqual (0, dl.Attributes.Count, "Attributes.Count-2");
Assert.AreEqual (0, dl.StateBag.Count, "ViewState.Count-2");
}
开发者ID:whereisaaron,项目名称:mono,代码行数:58,代码来源:DataListTest.cs
示例20: SelectedIndexTooLow
public void SelectedIndexTooLow ()
{
TestDataList dl = new TestDataList ();
dl.SelectedIndex = -2;
}
开发者ID:whereisaaron,项目名称:mono,代码行数:5,代码来源:DataListTest.cs
注:本文中的MonoTests.System.Web.UI.WebControls.TestDataList类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论