public void BoundField_AssignPropertyNotWorking() { PokerBoundField bf = new PokerBoundField(); bf.ApplyFormatInEditMode = true; Assert.AreEqual(true, bf.ApplyFormatInEditMode, "ApplyFormatInEditMode"); }
public void BoundField_DefaultPropertyNotWorking() { PokerBoundField bf = new PokerBoundField(); Assert.AreEqual(false, bf.ApplyFormatInEditMode, "ApplyFormatInEditMode"); Assert.AreEqual(true, bf.ConvertEmptyStringToNull, "ConvertEmptyStringToNull"); }
public void BoundField_CreateField() { PokerBoundField bf = new PokerBoundField(); BoundField newfield = (BoundField)bf.DoCreateField(); Assert.IsNotNull(newfield, "CreateField"); }
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 HtmlEncodeFormatString() { string formatString = "<script>alert ('{0}');</script>"; var bf = new PokerBoundField(); Assert.IsTrue(bf.HtmlEncodeFormatString, "#A1-2"); Assert.IsTrue(bf.HtmlEncode, "#A1-2"); Assert.IsTrue(bf.DoSupportsHtmlEncode, "#A1-3"); bf.DataFormatString = formatString; #if NET_4_0 Assert.AreEqual("<script>alert ('<test>');</script>", bf.DoFormatDataValue("<test>", true), "#A2"); #else Assert.AreEqual("<script>alert ('<test>');</script>", bf.DoFormatDataValue("<test>", true), "#A2"); #endif Assert.AreEqual(String.Format(formatString, "<test>"), bf.DoFormatDataValue("<test>", false), "#A3"); bf.HtmlEncodeFormatString = false; Assert.AreEqual("<script>alert ('<test>');</script>", bf.DoFormatDataValue("<test>", true), "#A4"); var ec = new EncodingTest(); bf.HtmlEncodeFormatString = true; #if NET_4_0 Assert.AreEqual("<script>alert ('<EncodingTest>&');</script>", bf.DoFormatDataValue(ec, true), "#A4"); #else Assert.AreEqual("<script>alert ('<EncodingTest>&');</script>", bf.DoFormatDataValue(ec, true), "#A4"); #endif }
public void BoundField_GetDesignTimeValue() { string result; PokerBoundField bf = new PokerBoundField(); result = (string)bf.DoGetDesignTimeValue(); Assert.AreEqual("Databound", result, "GetDesignTimeValue"); }
public void BoundField_GetValueNull() { PokerBoundField bf = new PokerBoundField(); SimpleSpreadsheetRow ds = new SimpleSpreadsheetRow(0, null); bf.DataField = PokerBoundField.ThisExpression; string result = (string)bf.DoGetValue(ds); }
public void BoundField_GetValue() { PokerBoundField bf = new PokerBoundField(); SimpleSpreadsheetRow ds = new SimpleSpreadsheetRow(0, "test"); bf.DataField = PokerBoundField.ThisExpression; string result = (string)bf.DoGetValue(ds); Assert.AreEqual("test", result, "GetValueFromIDataItemContainer"); }
public void BoundField_GetValueDataItem() { PokerBoundField bf = new PokerBoundField(); ControlWithDataItem ds = new ControlWithDataItem("test"); bf.DataField = PokerBoundField.ThisExpression; string result = (string)bf.DoGetValue(ds); Assert.AreEqual("test", result, "GetValueFromIDataItemContainer"); }
public void BoundField_ExtractValuesFromCell() { PokerBoundField bf = new PokerBoundField(); OrderedDictionary dictionary = new OrderedDictionary(); DataControlFieldCell cell = new DataControlFieldCell(null); cell.Text = "test"; bf.ExtractValuesFromCell(dictionary, cell, DataControlRowState.Normal, true); Assert.AreEqual(1, dictionary.Count, "ExtractValuesFromCellCount"); Assert.AreEqual("test", dictionary [0].ToString(), "ExtractValuesFromCellValue"); }
public void ImageField_Initialize() { Control control = new Control(); control.ID = "test"; PokerBoundField field = new PokerBoundField(); bool result = field.Initialize(true, control); Assert.AreEqual(false, result, "Initialize"); Assert.AreEqual("test", field.GetControl.ID, "InitializeControl"); }
public void BoundField_InitializeDataCell() { PokerBoundField bf = new PokerBoundField(); bf.HeaderText = "headertest"; DataControlFieldCell cell = new DataControlFieldCell(null); DataControlRowState state = DataControlRowState.Edit; Assert.AreEqual(0, cell.Controls.Count, "InitializeDataCellControlsBeforeInit"); bf.DoInitializeDataCell(cell, state); Assert.AreEqual(1, cell.Controls.Count, "InitializeDataCellControlsAfterInit"); }
public void BoundField_Initialize() { // This method initilize to private fields in a base class DataControlField // Always return false PokerBoundField bf = new PokerBoundField(); Control control = new Control(); control.ID = "test"; bool res = bf.Initialize(true, control); // Assert.AreEqual (false, res, "InitializeResult"); Assert.AreEqual("test", bf.GetControl.ID, "InitializeControl"); }
public void BoundField_DefaultProperty() { PokerBoundField bf = new PokerBoundField(); Assert.AreEqual("!", PokerBoundField.ThisExpression, "StaticThisExpression"); Assert.AreEqual("", bf.DataField, "DataField"); Assert.AreEqual("", bf.DataFormatString, "DataFormatString"); Assert.AreEqual("", bf.HeaderText, "HeaderText"); Assert.AreEqual(true, bf.HtmlEncode, "HtmlEncode"); Assert.AreEqual("", bf.NullDisplayText, "NullDisplayText"); Assert.AreEqual(false, bf.ReadOnly, "ReadOnly"); //Protected Assert.AreEqual(true, bf.DoSupportsHtmlEncode, "SupportsHtmlEncode"); }
public void BoundField_FormatDataValue() { string result; PokerBoundField bf = new PokerBoundField(); bf.NullDisplayText = "NullDisplayText"; result = bf.DoFormatDataValue(null, false); Assert.AreEqual("NullDisplayText", result, "FormatDataValueNullDataValue"); result = bf.DoFormatDataValue("test", true); Assert.AreEqual("test", result, "FormatDataValueTextDataValue"); result = bf.DoFormatDataValue("", true); Assert.AreEqual("NullDisplayText", result, "FormatEmptyDataValue"); bf.DataFormatString = "-{0,8:G}-"; result = bf.DoFormatDataValue(10, false); Assert.AreEqual("- 10-", result, "FormatDataValueWithFormat"); }
public void BoundField_AssignProperty() { PokerBoundField bf = new PokerBoundField(); bf.ConvertEmptyStringToNull = false; Assert.AreEqual(false, bf.ConvertEmptyStringToNull, "ConvertEmptyStringToNull"); bf.DataField = "test"; Assert.AreEqual("test", bf.DataField, "DataField"); bf.DataFormatString = "test"; Assert.AreEqual("test", bf.DataFormatString, "DataFormatString"); bf.HeaderText = "test"; Assert.AreEqual("test", bf.HeaderText, "HeaderText"); bf.HtmlEncode = false; Assert.AreEqual(false, bf.HtmlEncode, "HtmlEncode"); bf.NullDisplayText = "test"; Assert.AreEqual("test", bf.NullDisplayText, "NullDisplayText"); bf.ReadOnly = true; Assert.AreEqual(true, bf.ReadOnly, "ReadOnly"); }
public void BoundField_CopyProperties() { PokerBoundField bf = new PokerBoundField(); BoundField copy = new BoundField(); // Look not working property // bf.ApplyFormatInEditMode = true; bf.ConvertEmptyStringToNull = true; bf.DataField = "test"; bf.DataFormatString = "test"; bf.HtmlEncode = true; bf.NullDisplayText = "test"; bf.ReadOnly = true; bf.DoCopyProperties(copy); // Look not working property // Assert.AreEqual (true, copy.ApplyFormatInEditMode, "ApplyFormatInEditMode"); Assert.AreEqual(true, copy.ConvertEmptyStringToNull, "ConvertEmptyStringToNull"); Assert.AreEqual("test", copy.DataField, "DataField"); Assert.AreEqual("test", copy.DataFormatString, "DataFormatString"); Assert.AreEqual(true, copy.HtmlEncode, "HtmlEncode"); Assert.AreEqual("test", copy.NullDisplayText, "NullDisplayText"); Assert.AreEqual(true, copy.ReadOnly, "ReadOnly"); }
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_CreateField () { PokerBoundField bf = new PokerBoundField (); BoundField newfield = (BoundField) bf.DoCreateField (); Assert.IsNotNull (newfield, "CreateField"); }
public void BoundField_ExtractValuesFromCell () { PokerBoundField bf = new PokerBoundField (); OrderedDictionary dictionary = new OrderedDictionary (); DataControlFieldCell cell = new DataControlFieldCell (null); cell.Text = "test"; bf.ExtractValuesFromCell (dictionary, cell, DataControlRowState.Normal, true); Assert.AreEqual (1, dictionary.Count, "ExtractValuesFromCellCount"); Assert.AreEqual ("test", dictionary [0].ToString (), "ExtractValuesFromCellValue"); }
public void BoundField_Initialize () { // This method initilize to private fields in a base class DataControlField // Always return false PokerBoundField bf = new PokerBoundField (); Control control = new Control (); control.ID = "test"; bool res = bf.Initialize (true, control); // Assert.AreEqual (false, res, "InitializeResult"); Assert.AreEqual ("test", bf.GetControl.ID, "InitializeControl"); }
public void BoundField_GetValueNull () { PokerBoundField bf = new PokerBoundField (); SimpleSpreadsheetRow ds = new SimpleSpreadsheetRow (0, null); bf.DataField = PokerBoundField.ThisExpression; string result = (string) bf.DoGetValue (ds); }
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_DefaultPropertyNotWorking () { PokerBoundField bf = new PokerBoundField (); Assert.AreEqual (false, bf.ApplyFormatInEditMode, "ApplyFormatInEditMode"); Assert.AreEqual (true, bf.ConvertEmptyStringToNull, "ConvertEmptyStringToNull"); }
public void ImageField_Initialize () { Control control = new Control (); control.ID = "test"; PokerBoundField field = new PokerBoundField (); bool result = field.Initialize (true, control); Assert.AreEqual (false, result, "Initialize"); Assert.AreEqual ("test", field.GetControl.ID, "InitializeControl"); }
public void BoundField_FormatDataValue () { string result; PokerBoundField bf = new PokerBoundField (); bf.NullDisplayText = "NullDisplayText"; result = bf.DoFormatDataValue (null, false); Assert.AreEqual ("NullDisplayText", result, "FormatDataValueNullDataValue"); result = bf.DoFormatDataValue ("test", true); Assert.AreEqual ("test", result, "FormatDataValueTextDataValue"); result = bf.DoFormatDataValue ("", true); Assert.AreEqual ("NullDisplayText", result, "FormatEmptyDataValue"); bf.DataFormatString = "-{0,8:G}-"; result = bf.DoFormatDataValue (10, false); Assert.AreEqual ("- 10-", result, "FormatDataValueWithFormat"); }
public void BoundField_AssignPropertyNotWorking () { PokerBoundField bf = new PokerBoundField (); bf.ApplyFormatInEditMode = true; Assert.AreEqual (true, bf.ApplyFormatInEditMode, "ApplyFormatInEditMode"); }
public void BoundField_GetValueExeption () { PokerBoundField bf = new PokerBoundField (); bf.DoGetValue (null); }
public void HtmlEncodeFormatString () { string formatString = "<script>alert ('{0}');</script>"; var bf = new PokerBoundField (); Assert.IsTrue (bf.HtmlEncodeFormatString, "#A1-2"); Assert.IsTrue (bf.HtmlEncode, "#A1-2"); Assert.IsTrue (bf.DoSupportsHtmlEncode, "#A1-3"); bf.DataFormatString = formatString; #if NET_4_0 Assert.AreEqual ("<script>alert ('<test>');</script>", bf.DoFormatDataValue ("<test>", true), "#A2"); #else Assert.AreEqual ("<script>alert ('<test>');</script>", bf.DoFormatDataValue ("<test>", true), "#A2"); #endif Assert.AreEqual (String.Format (formatString, "<test>"), bf.DoFormatDataValue ("<test>", false), "#A3"); bf.HtmlEncodeFormatString = false; Assert.AreEqual ("<script>alert ('<test>');</script>", bf.DoFormatDataValue ("<test>", true), "#A4"); var ec = new EncodingTest (); bf.HtmlEncodeFormatString = true; #if NET_4_0 Assert.AreEqual ("<script>alert ('<EncodingTest>&');</script>", bf.DoFormatDataValue (ec, true), "#A4"); #else Assert.AreEqual ("<script>alert ('<EncodingTest>&');</script>", bf.DoFormatDataValue (ec, true), "#A4"); #endif }
public void BoundField_OnDataBindFieldExeption() { PokerBoundField bf = new PokerBoundField(); bf.bindbutoon.DataBind(); }
public void BoundField_GetValueDataItem () { PokerBoundField bf = new PokerBoundField (); ControlWithDataItem ds = new ControlWithDataItem ("test"); bf.DataField = PokerBoundField.ThisExpression; string result = (string) bf.DoGetValue (ds); Assert.AreEqual ("test", result, "GetValueFromIDataItemContainer"); }
public void BoundField_GetValue () { PokerBoundField bf = new PokerBoundField (); SimpleSpreadsheetRow ds = new SimpleSpreadsheetRow (0, "test"); bf.DataField = PokerBoundField.ThisExpression; string result = (string) bf.DoGetValue (ds); Assert.AreEqual ("test", result, "GetValueFromIDataItemContainer"); }
public void BoundField_AssignProperty () { PokerBoundField bf = new PokerBoundField (); bf.ConvertEmptyStringToNull = false; Assert.AreEqual (false, bf.ConvertEmptyStringToNull, "ConvertEmptyStringToNull"); bf.DataField = "test"; Assert.AreEqual ("test", bf.DataField, "DataField"); bf.DataFormatString = "test"; Assert.AreEqual ("test", bf.DataFormatString, "DataFormatString"); bf.HeaderText = "test"; Assert.AreEqual ("test", bf.HeaderText, "HeaderText"); bf.HtmlEncode = false; Assert.AreEqual (false, bf.HtmlEncode, "HtmlEncode"); bf.NullDisplayText = "test"; Assert.AreEqual ("test", bf.NullDisplayText, "NullDisplayText"); bf.ReadOnly = true; Assert.AreEqual (true, bf.ReadOnly, "ReadOnly"); }
public void BoundField_CopyProperties () { PokerBoundField bf = new PokerBoundField (); BoundField copy = new BoundField (); // Look not working property // bf.ApplyFormatInEditMode = true; bf.ConvertEmptyStringToNull = true; bf.DataField = "test"; bf.DataFormatString = "test"; bf.HtmlEncode = true; bf.NullDisplayText = "test"; bf.ReadOnly = true; bf.DoCopyProperties (copy); // Look not working property // Assert.AreEqual (true, copy.ApplyFormatInEditMode, "ApplyFormatInEditMode"); Assert.AreEqual (true, copy.ConvertEmptyStringToNull, "ConvertEmptyStringToNull"); Assert.AreEqual ("test", copy.DataField, "DataField"); Assert.AreEqual ("test", copy.DataFormatString, "DataFormatString"); Assert.AreEqual (true, copy.HtmlEncode, "HtmlEncode"); Assert.AreEqual ("test", copy.NullDisplayText, "NullDisplayText"); Assert.AreEqual (true, copy.ReadOnly, "ReadOnly"); }
public void BoundField_DefaultProperty () { PokerBoundField bf = new PokerBoundField (); Assert.AreEqual ("!", PokerBoundField.ThisExpression, "StaticThisExpression"); Assert.AreEqual ("", bf.DataField, "DataField"); Assert.AreEqual ("", bf.DataFormatString, "DataFormatString"); Assert.AreEqual ("", bf.HeaderText, "HeaderText"); Assert.AreEqual (true, bf.HtmlEncode, "HtmlEncode"); Assert.AreEqual ("", bf.NullDisplayText, "NullDisplayText"); Assert.AreEqual (false, bf.ReadOnly, "ReadOnly"); //Protected Assert.AreEqual (true, bf.DoSupportsHtmlEncode, "SupportsHtmlEncode"); }
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_InitializeDataCell () { PokerBoundField bf = new PokerBoundField (); bf.HeaderText = "headertest"; DataControlFieldCell cell = new DataControlFieldCell (null); DataControlRowState state = DataControlRowState.Edit; Assert.AreEqual (0, cell.Controls.Count, "InitializeDataCellControlsBeforeInit"); bf.DoInitializeDataCell (cell, state); Assert.AreEqual (1, cell.Controls.Count, "InitializeDataCellControlsAfterInit"); }
public void BoundField_GetDesignTimeValue () { string result; PokerBoundField bf = new PokerBoundField (); result = (string) bf.DoGetDesignTimeValue (); Assert.AreEqual ("Databound", result, "GetDesignTimeValue"); }
public void BoundField_GetValueExeption() { PokerBoundField bf = new PokerBoundField(); bf.DoGetValue(null); }
public void BoundField_OnDataBindFieldExeption () { PokerBoundField bf = new PokerBoundField (); bf.bindbutoon.DataBind (); }