本文整理汇总了C#中BusinessObjectCollection类的典型用法代码示例。如果您正苦于以下问题:C# BusinessObjectCollection类的具体用法?C# BusinessObjectCollection怎么用?C# BusinessObjectCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BusinessObjectCollection类属于命名空间,在下文中一共展示了BusinessObjectCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetAggregateRelationship
private static MultipleRelationship<ContactPersonTestBO> GetAggregateRelationship(OrganisationTestBO organisationTestBO, out BusinessObjectCollection<ContactPersonTestBO> cpCol) {
MultipleRelationship<ContactPersonTestBO> aggregateRelationship = organisationTestBO.Relationships.GetMultiple<ContactPersonTestBO>("ContactPeople");
RelationshipDef relationshipDef = (RelationshipDef) aggregateRelationship.RelationshipDef;
relationshipDef.RelationshipType = RelationshipType.Aggregation;
cpCol = aggregateRelationship.BusinessObjectCollection;
return aggregateRelationship;
}
示例2: Test_BusinessObjectEdited_ShouldRefreshTheValueInTheList
public void Test_BusinessObjectEdited_ShouldRefreshTheValueInTheList()
{
//---------------Set up test pack-------------------
ClassDef.ClassDefs.Clear();
MyBO.LoadDefaultClassDef();
var listBox = GetControlFactory().CreateListBox();
var manager = CreateListBoxCollectionManager(listBox);
var boToBeUpdated = new MyBO();
var myBoCol = new BusinessObjectCollection<MyBO> {new MyBO(), boToBeUpdated };
manager.BusinessObjectCollection = myBoCol;
manager.Control.SelectedItem = boToBeUpdated;
var initialListBoxDisplayText = manager.Control.Text;
var initialBOToString = boToBeUpdated.ToString();
//---------------Assert Precondition----------------
Assert.AreEqual(2, manager.Control.Items.Count);
Assert.AreSame(boToBeUpdated, manager.Control.Items[1]);
Assert.AreEqual(initialBOToString, initialListBoxDisplayText);
//---------------Execute Test ----------------------
boToBeUpdated.TestProp = GetRandomString();
boToBeUpdated.Save();
//---------------Test Result -----------------------
var updatedListBoxDisplayText = manager.Control.Text;
var updatedBOToString = boToBeUpdated.ToString();
Assert.AreNotEqual(initialListBoxDisplayText, updatedListBoxDisplayText);
Assert.AreNotEqual(initialBOToString, updatedBOToString);
Assert.AreEqual(updatedBOToString, updatedListBoxDisplayText);
}
示例3: TestBusinessObjectControlHasDifferentBOWhenTabChanges
public void TestBusinessObjectControlHasDifferentBOWhenTabChanges()
{
//---------------Set up test pack-------------------
IBOColTabControl boColTabControl = GetControlFactory().CreateBOColTabControl();
IBusinessObjectControl busControl = GetBusinessObjectControlStub();
boColTabControl.BusinessObjectControl = busControl;
BusinessObjectCollection<MyBO> myBoCol = new BusinessObjectCollection<MyBO>();
MyBO firstBo = new MyBO();
myBoCol.Add(firstBo);
myBoCol.Add(new MyBO());
MyBO thirdBO = new MyBO();
myBoCol.Add(thirdBO);
boColTabControl.BusinessObjectCollection = myBoCol;
//---------------Assert Precondition----------------
Assert.AreEqual(firstBo, boColTabControl.BusinessObjectControl.BusinessObject);
//---------------Execute Test ----------------------
boColTabControl.TabControl.SelectedIndex = 2;
//---------------Test Result -----------------------
Assert.AreNotSame(firstBo, boColTabControl.BusinessObjectControl.BusinessObject);
Assert.AreEqual(thirdBO, boColTabControl.BusinessObjectControl.BusinessObject);
}
示例4: TearDown
public void TearDown()
{
BusinessObjectCollection<Shape> shapes = new BusinessObjectCollection<Shape>();
shapes.LoadAll();
Shape[] shapesClone = shapes.ToArray();
foreach (Shape shape in shapesClone)
{
shape.MarkForDelete();
}
shapes.SaveAll();
//Shape shape = BOLoader.Instance.GetBusinessObject<Shape>(
// "ShapeName = 'MyShape' OR ShapeName = 'MyShapeChanged'");
//if (shape != null)
//{
// shape.MarkForDelete();
// shape.Save();
//}
//CircleNoPrimaryKey circle = BOLoader.Instance.GetBusinessObject<CircleNoPrimaryKey>(
// "ShapeName = 'Circle' OR ShapeName = 'CircleChanged'");
//if (circle != null)
//{
// circle.MarkForDelete();
// circle.Save();
//}
//FilledCircleInheritsCircleNoPK filledCircle = BOLoader.Instance.GetBusinessObject<FilledCircleInheritsCircleNoPK>(
// "ShapeName = 'FilledCircle' OR ShapeName = 'FilledCircleChanged'");
//if (filledCircle != null)
//{
// filledCircle.MarkForDelete();
// filledCircle.Save();
//}
}
示例5: GetRelationship
protected MultipleRelationship<ContactPersonTestBO> GetRelationship(
out OrganisationTestBO organisationTestBO,
out BusinessObjectCollection<ContactPersonTestBO> cpCol)
{
RelationshipCol relationships;
return GetRelationship(out organisationTestBO, out relationships, out cpCol);
}
示例6: SetupSelectorWithTestPackCollection
private static void SetupSelectorWithTestPackCollection(ComboBoxCollectionSelector selectorManager, bool includeBlankItems)
{
MyBO.LoadDefaultClassDef();
selectorManager.IncludeBlankItem = includeBlankItems;
BusinessObjectCollection<MyBO> myBOs = new BusinessObjectCollection<MyBO> { { new MyBO(), new MyBO() } };
selectorManager.SetCollection(myBOs);
}
示例7: InitialiseCollection
public void InitialiseCollection()
{
_boCol = new BusinessObjectCollection<MultiPropBO>();
_boCol.Add((MultiPropBO)_classDef.CreateNewBusinessObject());
_boCol.Add((MultiPropBO)_classDef.CreateNewBusinessObject());
//_boCol.Add((MultiPropBO)_classDef.CreateNewBusinessObject());
//_boCol.Add((MultiPropBO)_classDef.CreateNewBusinessObject());
}
示例8: GetData
public static BusinessObjectCollection GetData(int categoryId)
{
List<BusinessObject> result = GetData().FindAll(obj => obj.CategoryID == categoryId);
BusinessObjectCollection ret = new BusinessObjectCollection();
ret.Clear();
ret.AddRange(result);
return ret;
}
示例9: AssertAllCollectionsHaveNoItems
public static void AssertAllCollectionsHaveNoItems(BusinessObjectCollection<ContactPersonTestBO> cpCol)
{
Assert.AreEqual(0, cpCol.Count);
Assert.AreEqual(0, cpCol.AddedBusinessObjects.Count);
Assert.AreEqual(0, cpCol.RemovedBusinessObjects.Count);
Assert.AreEqual(0, cpCol.PersistedBusinessObjects.Count);
Assert.AreEqual(0, cpCol.MarkedForDeleteBusinessObjects.Count);
Assert.AreEqual(0, cpCol.CreatedBusinessObjects.Count);
}
示例10: GetCompositionRelationship
private static MultipleRelationship<ContactPersonTestBO> GetCompositionRelationship(out BusinessObjectCollection<ContactPersonTestBO> cpCol, OrganisationTestBO organisationTestBO)
{
MultipleRelationship<ContactPersonTestBO> compositionRelationship =
organisationTestBO.Relationships.GetMultiple<ContactPersonTestBO>("ContactPeople");
RelationshipDef relationshipDef = (RelationshipDef)compositionRelationship.RelationshipDef;
relationshipDef.RelationshipType = RelationshipType.Composition;
cpCol = compositionRelationship.BusinessObjectCollection;
return compositionRelationship;
}
示例11: GetHierarchicalData
public static BusinessObjectCollection GetHierarchicalData(int? parentId)
{
List<BusinessObject> result = GetData().FindAll(obj => obj.ParentID == parentId);
BusinessObjectCollection ret = new BusinessObjectCollection();
ret.Clear();
ret.AddRange(result);
return ret;
}
示例12:
public static void AssertOneObjectInCurrentPersistedCollectionOnly
(BusinessObjectCollection<ContactPersonTestBO> cpCol)
{
Assert.AreEqual(1, cpCol.Count);
Assert.AreEqual(0, cpCol.AddedBusinessObjects.Count);
Assert.AreEqual(0, cpCol.RemovedBusinessObjects.Count);
Assert.AreEqual(1, cpCol.PersistedBusinessObjects.Count);
Assert.AreEqual(0, cpCol.MarkedForDeleteBusinessObjects.Count);
Assert.AreEqual(0, cpCol.CreatedBusinessObjects.Count);
}
示例13: CreateDirtyChildren
protected void CreateDirtyChildren(BusinessObjectCollection<ContactPersonTestBO> cpCol,
out ContactPersonTestBO existingChild,
out ContactPersonTestBO editedChild,
out ContactPersonTestBO deletedChild,
out ContactPersonTestBO createdChildWithEdits,
out ContactPersonTestBO createdChild)
{
createdChild = CreateCreatedChild(cpCol);
createdChildWithEdits = CreateCreatedChildWithEdits(cpCol);
existingChild = CreateExistingChild(cpCol);
editedChild = CreateEditedChild(cpCol);
deletedChild = CreateDeletedChild(cpCol);
}
示例14: Test_BindBusinessObjectCollection_ToListBox_ShouldAddToControlList
public void Test_BindBusinessObjectCollection_ToListBox_ShouldAddToControlList()
{
//---------------Set up test pack-------------------
var lstBox = new ListBox();
var selectorBinder = new HabaneroSelectorControlBinder<FakeBo, ListBox>(lstBox);
var businessObjectCollection = new BusinessObjectCollection<FakeBo>();
businessObjectCollection.CreateBusinessObject();
//---------------Assert Precondition----------------
Assert.AreEqual(0, lstBox.Items.Count);
//---------------Execute Test ----------------------
selectorBinder.SetBusinessObjectCollection(businessObjectCollection);
//---------------Test Result -----------------------
Assert.AreEqual(1, lstBox.Items.Count, "The business object collection's items should be in list");
}
示例15: TestFixtureSetup
public void TestFixtureSetup()
{
//Code that is executed before any test is run in this class. If multiple tests
// are executed then it will still only be called once.
ClassDef.ClassDefs.Clear();
BOWithIntID.LoadClassDefWithIntID();
_propDef_int = new PropDef("PropName", typeof (int), PropReadWriteRule.ReadWrite, null);
_validBusinessObject = new BOWithIntID {TestField = _validLookupValue};
_validIntID = 3;
_validBusinessObject.IntID = _validIntID;
_collection_IntId = new BusinessObjectCollection<BOWithIntID> {_validBusinessObject};
_propDef_int.LookupList = new BusinessObjectLookupListStub(typeof (BOWithIntID), _collection_IntId);
}