public void NameIsUniqueID() { ListBoxPoker list = new ListBoxPoker(); Page page = new Page(); page.ID = "pg"; Control ctrl = new MyNC(); ctrl.ID = "ctrl"; page.Controls.Add(ctrl); ctrl.Controls.Add(list); string str = list.Render(); Assert.IsTrue(-1 != list.Render().IndexOf(':'), "unique"); }
public void DoubleDataBind() { ListBoxPoker l = new ListBoxPoker(); l.DataSource = GetExampleData(); l.DataTextField = "Company"; l.DataBind(); l.DataBind(); #if NET_2_0 string exp = @"<select size=""4""> <option value=""Novell Inc."">Novell Inc.</option> <option value=""Microsoft Corp."">Microsoft Corp.</option> <option value=""Google"">Google</option> </select>"; #else string exp = @"<select name size=""4""> <option value=""Novell Inc."">Novell Inc.</option> <option value=""Microsoft Corp."">Microsoft Corp.</option> <option value=""Google"">Google</option> </select>"; #endif HtmlDiff.AssertAreEqual(exp, l.Render(), "DoubleDataBind"); }
public void Render1() { ListBoxPoker l = new ListBoxPoker(); for (int i = 0; i < 3; i++) { l.Items.Add(i.ToString()); } l.SelectedIndex = l.Items.Count - 1; #if NET_2_0 string exp = @"<select size=""4""> <option value=""0"">0</option> <option value=""1"">1</option> <option selected=""selected"" value=""2"">2</option> </select>"; #else string exp = @"<select name size=""4""> <option value=""0"">0</option> <option value=""1"">1</option> <option selected=""selected"" value=""2"">2</option> </select>"; #endif HtmlDiff.AssertAreEqual(exp, l.Render(), "Render1"); }
public void HtmlEncodedText() { ListBoxPoker list = new ListBoxPoker(); // The att. value is encoded by the writer, but the text is encoded in ListBox. list.Items.Add(new ListItem("\"hola", "\"adios")); string output = list.Render(); Assert.IsTrue(-1 != output.IndexOf(""hola"), "#01"); Assert.IsTrue(-1 != output.IndexOf(""adios"), "#02"); }
public void HtmlEncodedText () { ListBoxPoker list = new ListBoxPoker (); // The att. value is encoded by the writer, but the text is encoded in ListBox. list.Items.Add (new ListItem ("\"hola", "\"adios")); string output = list.Render (); Assert.IsTrue (-1 != output.IndexOf (""hola"), "#01"); Assert.IsTrue (-1 != output.IndexOf (""adios"), "#02"); }
public void NameIsUniqueID () { ListBoxPoker list = new ListBoxPoker (); Page page = new Page (); page.ID = "pg"; Control ctrl = new MyNC (); ctrl.ID = "ctrl"; page.Controls.Add (ctrl); ctrl.Controls.Add (list); string str = list.Render(); Assert.IsTrue (-1 != list.Render ().IndexOf (':'), "unique"); }
public void DoubleDataBind () { ListBoxPoker l = new ListBoxPoker (); l.DataSource = GetExampleData (); l.DataTextField = "Company"; l.DataBind (); l.DataBind (); string exp = @"<select size=""4""> <option value=""Novell Inc."">Novell Inc.</option> <option value=""Microsoft Corp."">Microsoft Corp.</option> <option value=""Google"">Google</option> </select>"; HtmlDiff.AssertAreEqual (exp, l.Render (), "DoubleDataBind"); }
public void Render1 () { ListBoxPoker l = new ListBoxPoker (); for (int i = 0; i < 3; i ++) l.Items.Add (i.ToString ()); l.SelectedIndex = l.Items.Count - 1; string exp = @"<select size=""4""> <option value=""0"">0</option> <option value=""1"">1</option> <option selected=""selected"" value=""2"">2</option> </select>"; HtmlDiff.AssertAreEqual (exp, l.Render (), "Render1"); }