public void BoundField_SortExpression() { // Sorting enable = true , link button must be created PokerBoundField bf = new PokerBoundField(); // Header text DataControlFieldCell cell = new DataControlFieldCell(null); bf.HeaderImageUrl = ""; bf.SortExpression = "a"; bf.HeaderText = "sortbutton"; bf.Initialize(true, new Control()); // _base._sortingenable set to true bf.InitializeCell(cell, DataControlCellType.Header, DataControlRowState.Edit, 1); if (cell.Controls [0] is Button) // mono { Button lb = (Button)cell.Controls [0]; Assert.AreEqual("Sort", lb.CommandName, "InitializeCellHeaderSortButtonCommand"); Assert.AreEqual("a", lb.CommandArgument, "InitializeCellHeaderSortButtonArgument"); Assert.AreEqual("sortbutton", lb.Text, "InitializeCellHeaderSortButtonText"); } else if (cell.Controls [0] is LinkButton) // .net { LinkButton lb = (LinkButton)cell.Controls [0]; Assert.AreEqual("Sort", lb.CommandName, "InitializeCellHeaderSortButtonCommand"); Assert.AreEqual("a", lb.CommandArgument, "InitializeCellHeaderSortButtonArgument"); Assert.AreEqual("sortbutton", lb.Text, "InitializeCellHeaderSortButtonText"); } else { Assert.Fail("Sort button does not created"); } }
public void BoundField_InitializeCell() { PokerBoundField bf = new PokerBoundField(); // Header text DataControlFieldCell cell = new DataControlFieldCell(null); bf.HeaderText = "headertext"; bf.InitializeCell(cell, DataControlCellType.Header, DataControlRowState.Edit, 1); Assert.AreEqual("headertext", cell.Text, "InitializeCellHeaderText"); // Empty header text bf.HeaderText = ""; bf.InitializeCell(cell, DataControlCellType.Header, DataControlRowState.Edit, 1); Assert.AreEqual(" ", cell.Text, "InitializeCellEmpty"); bf.HeaderText = "headertext"; // Header image url not empty bf.HeaderImageUrl = "headerurl"; bf.InitializeCell(cell, DataControlCellType.Header, DataControlRowState.Edit, 1); if (cell.Controls [0] is Image) { Image image = (Image)cell.Controls [0]; Assert.AreEqual("headerurl", image.ImageUrl, "InitializeCellHeaderImageUrl"); } else { Assert.Fail("Header Image dos not created"); } // Footer empty bf.FooterText = "footertext"; bf.InitializeCell(cell, DataControlCellType.Footer, DataControlRowState.Edit, 1); Assert.AreEqual("footertext", cell.Text, "InitializeCellFooterText"); bf.FooterText = ""; bf.InitializeCell(cell, DataControlCellType.Footer, DataControlRowState.Edit, 1); Assert.AreEqual(" ", cell.Text, "InitializeCellFooterEmpty"); }
public void BoundField_SortExpression () { // Sorting enable = true , link button must be created PokerBoundField bf = new PokerBoundField (); // Header text DataControlFieldCell cell = new DataControlFieldCell (null); bf.HeaderImageUrl = ""; bf.SortExpression = "a"; bf.HeaderText = "sortbutton"; bf.Initialize (true, new Control ()); // _base._sortingenable set to true bf.InitializeCell (cell, DataControlCellType.Header, DataControlRowState.Edit, 1); if (cell.Controls [0] is Button) { // mono Button lb = (Button) cell.Controls [0]; Assert.AreEqual ("Sort", lb.CommandName, "InitializeCellHeaderSortButtonCommand"); Assert.AreEqual ("a", lb.CommandArgument, "InitializeCellHeaderSortButtonArgument"); Assert.AreEqual ("sortbutton", lb.Text, "InitializeCellHeaderSortButtonText"); } else if (cell.Controls [0] is LinkButton) { // .net LinkButton lb = (LinkButton) cell.Controls [0]; Assert.AreEqual ("Sort", lb.CommandName, "InitializeCellHeaderSortButtonCommand"); Assert.AreEqual ("a", lb.CommandArgument, "InitializeCellHeaderSortButtonArgument"); Assert.AreEqual ("sortbutton", lb.Text, "InitializeCellHeaderSortButtonText"); } else { Assert.Fail ("Sort button does not created"); } }
public void BoundField_InitializeCell () { PokerBoundField bf = new PokerBoundField (); // Header text DataControlFieldCell cell = new DataControlFieldCell (null); bf.HeaderText = "headertext"; bf.InitializeCell (cell, DataControlCellType.Header, DataControlRowState.Edit, 1); Assert.AreEqual ("headertext", cell.Text, "InitializeCellHeaderText"); // Empty header text bf.HeaderText = ""; bf.InitializeCell (cell, DataControlCellType.Header, DataControlRowState.Edit, 1); Assert.AreEqual (" ", cell.Text, "InitializeCellEmpty"); bf.HeaderText = "headertext"; // Header image url not empty bf.HeaderImageUrl = "headerurl"; bf.InitializeCell (cell, DataControlCellType.Header, DataControlRowState.Edit, 1); if (cell.Controls [0] is Image) { Image image = (Image) cell.Controls [0]; Assert.AreEqual ("headerurl", image.ImageUrl, "InitializeCellHeaderImageUrl"); } else { Assert.Fail ("Header Image dos not created"); } // Footer empty bf.FooterText = "footertext"; bf.InitializeCell (cell, DataControlCellType.Footer, DataControlRowState.Edit, 1); Assert.AreEqual ("footertext", cell.Text, "InitializeCellFooterText"); bf.FooterText = ""; bf.InitializeCell (cell, DataControlCellType.Footer, DataControlRowState.Edit, 1); Assert.AreEqual (" ", cell.Text, "InitializeCellFooterEmpty"); }