private void Page_Load(object sender, System.EventArgs e) { HtmlForm frm = (HtmlForm)(HtmlForm)this.FindControl("Form1"); this.GHTTestBegin(frm); // SubTest Reference equality this.GHTSubTestBegin("Reference equality"); try { System.Web.UI.WebControls.ListItem item1 = new System.Web.UI.WebControls.ListItem("Text", "Value"); System.Web.UI.WebControls.ListItem item2 = item1; Compare(item1.Equals(item2), true); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); GHTTestBegin(frm); // SubTest Text & Value equal, but selected is not equal GHTSubTestBegin("Text & Value equal, but selected is not equal"); try { System.Web.UI.WebControls.ListItem item3 = new System.Web.UI.WebControls.ListItem("Text", "Value"); item3.Selected = true; System.Web.UI.WebControls.ListItem item4 = new System.Web.UI.WebControls.ListItem("Text", "Value"); item4.Selected = false; Compare(item3.Equals(item4), true); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); // SubTest Values are not equal GHTSubTestBegin("Values are not equal"); try { System.Web.UI.WebControls.ListItem item5 = new System.Web.UI.WebControls.ListItem("Text", "Value1"); System.Web.UI.WebControls.ListItem item6 = new System.Web.UI.WebControls.ListItem("Text", "Value2"); Compare(item5.Equals(item6), false); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); // SubTest Texts are not equal GHTSubTestBegin("Texts are not equal"); try { System.Web.UI.WebControls.ListItem item7 = new System.Web.UI.WebControls.ListItem("Text1", "Value"); System.Web.UI.WebControls.ListItem item8 = new System.Web.UI.WebControls.ListItem("Text2", "Value"); Compare(item7.Equals(item8), false); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); // SubTest FakeListItem GHTSubTestBegin("FakeListItem"); try { System.Web.UI.WebControls.ListItem item9 = new System.Web.UI.WebControls.ListItem("Text", "Value"); FakeListItem item10 = new FakeListItem("Text", "Value"); Compare(item9.Equals(item10), false); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); GHTTestEnd(); }
private void Page_Load(object sender, System.EventArgs e) { HtmlForm frm = (HtmlForm) (HtmlForm)this.FindControl("Form1"); this.GHTTestBegin(frm); // SubTest Reference equality this.GHTSubTestBegin("Reference equality"); try { System.Web.UI.WebControls.ListItem item1 = new System.Web.UI.WebControls.ListItem("Text", "Value"); System.Web.UI.WebControls.ListItem item2 = item1; Compare(item1.Equals(item2), true); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); GHTTestBegin(frm); // SubTest Text & Value equal, but selected is not equal GHTSubTestBegin("Text & Value equal, but selected is not equal"); try { System.Web.UI.WebControls.ListItem item3 = new System.Web.UI.WebControls.ListItem("Text", "Value"); item3.Selected = true; System.Web.UI.WebControls.ListItem item4 = new System.Web.UI.WebControls.ListItem("Text", "Value"); item4.Selected = false; Compare(item3.Equals(item4), true); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); // SubTest Values are not equal GHTSubTestBegin("Values are not equal"); try { System.Web.UI.WebControls.ListItem item5 = new System.Web.UI.WebControls.ListItem("Text", "Value1"); System.Web.UI.WebControls.ListItem item6 = new System.Web.UI.WebControls.ListItem("Text", "Value2"); Compare(item5.Equals(item6), false); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); // SubTest Texts are not equal GHTSubTestBegin("Texts are not equal"); try { System.Web.UI.WebControls.ListItem item7 = new System.Web.UI.WebControls.ListItem("Text1", "Value"); System.Web.UI.WebControls.ListItem item8 = new System.Web.UI.WebControls.ListItem("Text2", "Value"); Compare(item7.Equals(item8), false); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); // SubTest FakeListItem GHTSubTestBegin("FakeListItem"); try { System.Web.UI.WebControls.ListItem item9 = new System.Web.UI.WebControls.ListItem("Text", "Value"); FakeListItem item10 = new FakeListItem("Text", "Value"); Compare(item9.Equals(item10), false); } catch (Exception ex) { GHTSubTestUnexpectedExceptionCaught(ex); } GHTSubTestEnd(); GHTTestEnd(); }