本文整理汇总了C#中UIGrid.Add方法的典型用法代码示例。如果您正苦于以下问题:C# UIGrid.Add方法的具体用法?C# UIGrid.Add怎么用?C# UIGrid.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIGrid
的用法示例。
在下文中一共展示了UIGrid.Add方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCopyTo
public void TestCopyTo()
{
UIGridColumn column1 = new UIGridColumn("heading", null, null, null, false,
100, PropAlignment.left, null);
UIGridColumn column2 = new UIGridColumn("heading", null, null, null, false,
100, PropAlignment.left, null);
UIGrid uiGrid = new UIGrid();
uiGrid.Add(column1);
uiGrid.Add(column2);
UIGridColumn[] target = new UIGridColumn[2];
uiGrid.CopyTo(target, 0);
Assert.AreEqual(column1, target[0]);
Assert.AreEqual(column2, target[1]);
}
示例2: TestRemove
public void TestRemove()
{
UIGridColumn column = new UIGridColumn("heading", null, null, null, false,
100, PropAlignment.left, null);
UIGrid uiGrid = new UIGrid();
uiGrid.Add(column);
Assert.IsTrue(uiGrid.Contains(column));
uiGrid.Remove(column);
Assert.IsFalse(uiGrid.Contains(column));
}
示例3: TestCloneUIGrid
public void TestCloneUIGrid()
{
UIGridColumn uiGridCol = new UIGridColumn("Head", "Prop", "control", "Assembly",true,100, PropAlignment.centre, null);
UIGrid uiGrid = new UIGrid();
uiGrid.SortColumn = "Prop";
uiGrid.Add(uiGridCol);
//---------------Execute Test ----------------------
IUIGrid clonedGrid = uiGrid.Clone();
//---------------Test Result -----------------------
Assert.IsTrue(uiGrid.Equals(clonedGrid));
Assert.IsTrue(uiGrid == (UIGrid) clonedGrid);
Assert.IsFalse(uiGrid != (UIGrid) clonedGrid);
Assert.AreEqual(uiGrid[0], clonedGrid[0],
"Should be a deep copy and the columns should be equal but copied");
Assert.AreNotSame(uiGrid[0], clonedGrid[0], "Should be a deep copy and the columns should be equal but copied (not same)");
}
示例4: Test_AddColumn_ShouldSetColumnsUIGrid
public void Test_AddColumn_ShouldSetColumnsUIGrid()
{
//---------------Set up test pack-------------------
IUIGrid uiGrid = new UIGrid();
var column = MockRepository.GenerateStub<IUIGridColumn>();
//---------------Assert Precondition----------------
Assert.IsNull(column.UIGrid);
//---------------Execute Test ----------------------
uiGrid.Add(column);
//---------------Test Result -----------------------
Assert.AreSame(uiGrid, column.UIGrid);
}
示例5: Test_Indexer_FindBy_PropertyName_DoesntExistReturnsNull
public void Test_Indexer_FindBy_PropertyName_DoesntExistReturnsNull()
{
//---------------Set up test pack-------------------
UIGrid uiGrid = new UIGrid();
UIGridColumn uiGridColumn = GetUiGridColumn();
uiGrid.Add(uiGridColumn);
UIGridColumn uiGridColumn2 = GetUiGridColumn("Diff Prop Name");
uiGrid.Add(uiGridColumn2);
//--------------Assert PreConditions----------------
Assert.AreEqual(2, uiGrid.Count);
//---------------Execute Test ----------------------
IUIGridColumn column = uiGrid["nonexistent property"];
//---------------Test Result -----------------------
Assert.IsNull(column);
}
示例6: Test_Indexer_FindBy_PropertyName
public void Test_Indexer_FindBy_PropertyName()
{
//---------------Set up test pack-------------------
UIGrid uiGrid = new UIGrid();
UIGridColumn uiGridColumn = GetUiGridColumn();
uiGrid.Add(uiGridColumn);
UIGridColumn uiGridColumn2 = GetUiGridColumn("Diff Prop Name");
uiGrid.Add(uiGridColumn2);
//--------------Assert PreConditions----------------
Assert.AreEqual(2, uiGrid.Count);
//---------------Execute Test ----------------------
IUIGridColumn column = uiGrid[uiGridColumn2.PropertyName];
//---------------Test Result -----------------------
Assert.AreEqual(uiGridColumn2, column);
}
示例7: Test_EqualHasCopyOfGridColumn
public void Test_EqualHasCopyOfGridColumn()
{
//---------------Set up test pack-------------------
UIGrid uiGrid = new UIGrid();
UIGridColumn uiGridColumn = GetUiGridColumn();
uiGrid.Add(uiGridColumn);
//--------------Assert PreConditions----------------
//---------------Execute Test ----------------------
UIGrid uiGrid2 = new UIGrid();
uiGrid2.Add(uiGridColumn.Clone());
//---------------Test Result -----------------------
Assert.IsTrue(uiGrid.Equals(uiGrid2));
Assert.IsTrue(uiGrid == uiGrid2);
Assert.IsFalse(uiGrid != uiGrid2);
//---------------Tear Down -------------------------
}
示例8: Test_NotEqual_HasDifferentNumbersOfColumns
public void Test_NotEqual_HasDifferentNumbersOfColumns()
{
//---------------Set up test pack-------------------
UIGrid uiGrid = new UIGrid();
UIGridColumn uiGridColumn = GetUiGridColumn();
uiGrid.Add(uiGridColumn);
uiGrid.Add(GetUiGridColumn());
UIGrid uiGrid2 = new UIGrid();
uiGrid2.Add(uiGridColumn);
//--------------Assert PreConditions----------------
Assert.AreEqual(2, uiGrid.Count);
Assert.AreEqual(1, uiGrid2.Count);
//---------------Execute Test ----------------------
//---------------Test Result -----------------------
Assert.IsFalse(uiGrid.Equals(uiGrid2));
Assert.IsFalse(uiGrid == uiGrid2);
Assert.IsTrue(uiGrid != uiGrid2);
//---------------Tear Down -------------------------
}
示例9: Test_NotEqualHasTheDifferentPropName_GridColumn
public void Test_NotEqualHasTheDifferentPropName_GridColumn()
{
UIGrid uiGrid = new UIGrid();
UIGridColumn uiGridColumn = GetUiGridColumn();
uiGrid.Add(uiGridColumn);
UIGrid uiGrid2 = new UIGrid();
UIGridColumn uiGridColumn2 = GetUiGridColumn("Diff Prop Name");
uiGrid2.Add(uiGridColumn2);
Assert.IsFalse(uiGrid.Equals(uiGrid2));
Assert.IsFalse(uiGrid == uiGrid2);
Assert.IsTrue(uiGrid != uiGrid2);
}
示例10: Test_EqualHasTheSameGridColumn
public void Test_EqualHasTheSameGridColumn()
{
UIGrid uiGrid = new UIGrid();
UIGridColumn uiGridColumn = GetUiGridColumn();
uiGrid.Add(uiGridColumn);
UIGrid uiGrid2 = new UIGrid();
//UIGridColumn uiGridColumn2 = GetUiGridColumn();
uiGrid2.Add(uiGridColumn);
Assert.IsTrue(uiGrid.Equals(uiGrid2));
Assert.IsTrue(uiGrid == uiGrid2);
Assert.IsFalse(uiGrid != uiGrid2);
}
示例11: GetUiGrid
private static UIGrid GetUiGrid()
{
UIGridColumn uiGridCol =
new UIGridColumn
("Head", "Prop", "control", "Assembly", true, 100, PropAlignment.centre, null);
UIGrid uiGrid = new UIGrid();
uiGrid.SortColumn = "Prop";
uiGrid.Add(uiGridCol);
return uiGrid;
}
示例12: Test_AddRow_WhenVirtualProp_ShouldAddBOWithRelatedVirtualPropSet
public void Test_AddRow_WhenVirtualProp_ShouldAddBOWithRelatedVirtualPropSet()
{
//---------------Set up test pack-------------------
RecordingExceptionNotifier recordingExceptionNotifier = new RecordingExceptionNotifier();
GlobalRegistry.UIExceptionNotifier = recordingExceptionNotifier;
AddressTestBO.LoadDefaultClassDef();
var contactPersonClassDef = ContactPersonTestBO.LoadClassDefWithOrganisationAndAddressRelationships();
OrganisationTestBO.LoadDefaultClassDef();
BusinessObjectCollection<ContactPersonTestBO> contactPersonTestBOS = new BusinessObjectCollection<ContactPersonTestBO>();
OrganisationTestBO organisation = new OrganisationTestBO();
UIGrid uiGrid = new UIGrid();
new UIDef("fdafdas", new UIForm(), uiGrid) {ClassDef = contactPersonClassDef};
const string propertyName = "-Organisation-";
uiGrid.Add(new UIGridColumn("Contact Organisation", propertyName, typeof(DataGridViewTextBoxColumn), true, 100, PropAlignment.left, new Hashtable()));
IDataSetProvider dataSetProvider = CreateDataSetProvider(contactPersonTestBOS);
DataTable table = dataSetProvider.GetDataTable(uiGrid);
//---------------Assert Precondition----------------
Assert.IsTrue(dataSetProvider is EditableDataSetProvider);
Assert.AreEqual(0, table.Rows.Count);
Assert.AreEqual(0, contactPersonTestBOS.Count);
//---------------Execute Test ----------------------
table.Rows.Add(new object[] { null, organisation });
//---------------Test Result -----------------------
Assert.AreEqual(1, table.Rows.Count);
Assert.AreEqual(1, contactPersonTestBOS.Count);
Assert.AreSame(organisation, table.Rows[0][propertyName]);
Assert.AreSame(organisation, contactPersonTestBOS[0].Organisation);
}
示例13: Test_AddRow_WhenMultipleLevelProp_ShouldAddBOWithRelatedPropSet
public void Test_AddRow_WhenMultipleLevelProp_ShouldAddBOWithRelatedPropSet()
{
//---------------Set up test pack-------------------
RecordingExceptionNotifier recordingExceptionNotifier = new RecordingExceptionNotifier();
GlobalRegistry.UIExceptionNotifier = recordingExceptionNotifier;
ClassDef.ClassDefs.Clear();
AddressTestBO.LoadDefaultClassDef();
ContactPersonTestBO.LoadClassDefWithOrganisationAndAddressRelationships();
OrganisationTestBO.LoadDefaultClassDef();
ContactPersonTestBO contactPersonTestBO = ContactPersonTestBO.CreateSavedContactPerson();
BusinessObjectCollection<AddressTestBO> addresses = contactPersonTestBO.Addresses;
OrganisationTestBO organisation = new OrganisationTestBO();
UIGrid uiGrid = new UIGrid();
const string propertyName = "ContactPersonTestBO.OrganisationID";
uiGrid.Add(new UIGridColumn("Contact Organisation", propertyName, typeof(DataGridViewTextBoxColumn), true, 100, PropAlignment.left, new Hashtable()));
IDataSetProvider dataSetProvider = CreateDataSetProvider(addresses);
DataTable table = dataSetProvider.GetDataTable(uiGrid);
//---------------Assert Precondition----------------
Assert.IsTrue(dataSetProvider is EditableDataSetProvider);
Assert.AreEqual(0, table.Rows.Count);
Assert.AreEqual(0, addresses.Count);
//---------------Execute Test ----------------------
table.Rows.Add(new object[] { null, organisation.OrganisationID });
//---------------Test Result -----------------------
Assert.AreEqual(1, table.Rows.Count);
Assert.AreEqual(1, addresses.Count);
Assert.AreEqual(organisation.OrganisationID.ToString(), table.Rows[0][propertyName].ToString());
Assert.AreEqual(organisation.OrganisationID, contactPersonTestBO.OrganisationID);
recordingExceptionNotifier.RethrowRecordedException();
}
示例14: GetUIGridProperties
public UIGrid GetUIGridProperties()
{
UIGrid col = new UIGrid();
col.Add(
new UIGridColumn("Text:", "SampleText", "DataGridViewTextBoxColumn", null, true, 100,
PropAlignment.left, null));
return col;
}