当前位置: 首页>>代码示例>>C#>>正文


C# BusinessObjectCollection.CreateBusinessObject方法代码示例

本文整理汇总了C#中BusinessObjectCollection.CreateBusinessObject方法的典型用法代码示例。如果您正苦于以下问题:C# BusinessObjectCollection.CreateBusinessObject方法的具体用法?C# BusinessObjectCollection.CreateBusinessObject怎么用?C# BusinessObjectCollection.CreateBusinessObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BusinessObjectCollection的用法示例。


在下文中一共展示了BusinessObjectCollection.CreateBusinessObject方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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");
 }
开发者ID:Chillisoft,项目名称:habanero.binding,代码行数:14,代码来源:TestHabaneroSelectorControlBinder.cs

示例2: Test_CreateBusObject

        public void Test_CreateBusObject()
        {
            //---------------Set up test pack-------------------
            //ContactPersonTestBO.LoadDefaultClassDef();
            BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
            cpCol.LoadAll();
            RegisterForAddedEvent(cpCol);

            //---------------Assert Precondition----------------
            Assert.AreEqual(0, cpCol.Count);
            Assert.IsFalse(_addedEventFired);
            Assert.AreEqual(0, cpCol.PersistedBusinessObjects.Count);

            //---------------Execute Test ----------------------
            ContactPersonTestBO newCP = cpCol.CreateBusinessObject();

            //---------------Test Result -----------------------
            AssertOneObjectInCurrentAndCreatedCollection(cpCol);

            Assert.Contains(newCP, cpCol.CreatedBusinessObjects);
            Assert.Contains(newCP, cpCol);
            Assert.IsFalse(cpCol.PersistedBusinessObjects.Contains(newCP));
            Assert.IsTrue(_addedEventFired);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:24,代码来源:TestBusinessObjectCollection_CreateBO.cs

示例3: GetBusinessObjectCollectionWith3Items

 private static BusinessObjectCollection<FakeBo> GetBusinessObjectCollectionWith3Items()
 {
     var businessObjectCollection = new BusinessObjectCollection<FakeBo>();
     businessObjectCollection.CreateBusinessObject();
     businessObjectCollection.CreateBusinessObject();
     businessObjectCollection.CreateBusinessObject();
     return businessObjectCollection;
 }
开发者ID:Chillisoft,项目名称:habanero.binding,代码行数:8,代码来源:TestHabaneroSelectorControlBinder.cs

示例4: Test_CreatedBusinessObject_SaveBO

        public void Test_CreatedBusinessObject_SaveBO()
        {
            //Saving a created business object should remove the business
            // object from the created col. it should still exist in 
            // the main collection and should be added to the persisted collection
            //---------------Set up test pack-------------------
            //ContactPersonTestBO.LoadDefaultClassDef();

            BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
            cpCol.LoadAll();

            ContactPersonTestBO newCP = cpCol.CreateBusinessObject();
            newCP.Surname = TestUtil.GetRandomString();
            RegisterForAddedEvent(cpCol);

            //---------------Assert Preconditions --------------
            Assert.IsFalse(_addedEventFired);
            AssertOneObjectInCurrentAndCreatedCollection(cpCol);

            //---------------Execute Test ----------------------
            newCP.Save();

            //---------------Test Result -----------------------
            Assert.IsFalse(_addedEventFired);
            Assert.Contains(newCP, cpCol);
            AssertOneObjectInCurrentAndPersistedCollection(cpCol);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:27,代码来源:TestBusinessObjectCollection_CreateBO.cs

示例5: Test_RefreshAll_W_CreatedBO

        public void Test_RefreshAll_W_CreatedBO()
        {
            //---------------Set up test pack-------------------
            BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
            cpCol.CreateBusinessObject();
            RegisterForAddedAndRemovedEvents(cpCol);

            //---------------Assert Precondition----------------
            AssertOneObjectInCurrentAndCreatedCollection(cpCol);

            //---------------Execute Test ----------------------
            cpCol.Refresh();

            //---------------Test Result -----------------------
            AssertOneObjectInCurrentAndCreatedCollection(cpCol);
            AssertAddedAndRemovedEventsNotFired();
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:17,代码来源:TestBusinessObjectCollection_CreateBO.cs

示例6: Test_CreatedBusinessObject_Add

        public void Test_CreatedBusinessObject_Add()
        {
            //---------------Set up test pack-------------------
            //ContactPersonTestBO.LoadDefaultClassDef();
            BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
            ContactPersonTestBO newCP = cpCol.CreateBusinessObject();
            newCP.Surname = TestUtil.GetRandomString();
            RegisterForAddedAndRemovedEvents(cpCol);

            //---------------Assert Precondition----------------
            AssertOneObjectInCurrentAndCreatedCollection(cpCol);

            //---------------Execute Test ----------------------
            cpCol.Add(newCP);

            //---------------Test Result -----------------------
            AssertOneObjectInCurrentAndCreatedCollection(cpCol);
            AssertAddedAndRemovedEventsNotFired();
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:19,代码来源:TestBusinessObjectCollection_CreateBO.cs

示例7: Test_CreatedBusinessObject_Refresh

        public void Test_CreatedBusinessObject_Refresh()
        {
            //---------------Set up test pack-------------------
            //ContactPersonTestBO.LoadDefaultClassDef();
            BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
            ContactPersonTestBO newCP = cpCol.CreateBusinessObject();
            newCP.Surname = TestUtil.GetRandomString();

            //---------------Assert Precondition----------------
            AssertOneObjectInCurrentAndCreatedCollection(cpCol);

            //---------------Execute Test ----------------------
            BORegistry.DataAccessor.BusinessObjectLoader.Refresh(newCP);

            //---------------Test Result -----------------------            
            AssertOneObjectInCurrentAndCreatedCollection(cpCol);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:17,代码来源:TestBusinessObjectCollection_CreateBO.cs

示例8: Test_ClearClearsCreatedCollection

        public void Test_ClearClearsCreatedCollection()
        {
            //---------------Set up test pack-------------------
            ContactPersonTestBO.LoadDefaultClassDef();
            BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
            ContactPersonTestBO.DeleteAllContactPeople();
            CreateTwoSavedContactPeople();
            cpCol.CreateBusinessObject();

            //---------------Assert Precondition----------------
            Assert.AreEqual(1, cpCol.CreatedBusinessObjects.Count);

            //---------------Execute Test ----------------------
            cpCol.Clear();

            //---------------Test Result -----------------------
            Assert.AreEqual(0, cpCol.CreatedBusinessObjects.Count);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:18,代码来源:TestBusinessObjectCollection.cs

示例9: Test_CreatedBusinessObject_RestoredTwice

        public void Test_CreatedBusinessObject_RestoredTwice()
        {
            //---------------Set up test pack-------------------
            //ContactPersonTestBO.LoadDefaultClassDef();
            BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
            ContactPersonTestBO newCP = cpCol.CreateBusinessObject();
            newCP.Surname = TestUtil.GetRandomString();
            newCP.CancelEdits();

            //---------------Assert Precondition----------------
            AssertOneObjectInCurrentAndCreatedCollection(cpCol);

            //---------------Execute Test ----------------------
            newCP.CancelEdits();

            //---------------Test Result -----------------------
            AssertOneObjectInCurrentAndCreatedCollection(cpCol);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:18,代码来源:TestBusinessObjectCollection_CreateBO.cs

示例10: CreateExistingChild

 protected static ContactPersonTestBO CreateExistingChild(BusinessObjectCollection<ContactPersonTestBO> cpCol)
 {
     ContactPersonTestBO existingChildEdited = cpCol.CreateBusinessObject();
     existingChildEdited.Surname = TestUtil.GetRandomString();
     existingChildEdited.FirstName = TestUtil.GetRandomString();
     existingChildEdited.Save();
     return existingChildEdited;
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:8,代码来源:TestMultipleRelationshipCancelEdits_Base.cs

示例11: CreateCreatedChild

 protected static ContactPersonTestBO CreateCreatedChild(BusinessObjectCollection<ContactPersonTestBO> cpCol)
 {
     ContactPersonTestBO createdChildUnedited = cpCol.CreateBusinessObject();
     return createdChildUnedited;
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:5,代码来源:TestMultipleRelationshipCancelEdits_Base.cs

示例12: Test_CreateBusinessObject_AlternateClassDef_NoConstructor_ShouldThrowException

        public void Test_CreateBusinessObject_AlternateClassDef_NoConstructor_ShouldThrowException()
        {
            //---------------Set up test pack-------------------
            ClassDef classDef = (ClassDef) OrganisationTestBO.LoadDefaultClassDef();
            ClassDef alternateClassDef = classDef.Clone();
            alternateClassDef.TypeParameter = TestUtil.GetRandomString();
            BusinessObjectCollection<OrganisationTestBO> orgCol = new BusinessObjectCollection<OrganisationTestBO>
                                                                      {ClassDef = alternateClassDef};

            //---------------Execute Test ----------------------
            try
            {

                //this should not work because OrganisationTestBO does not have a constructor that takes a ClassDef as parameter
                orgCol.CreateBusinessObject();

                Assert.Fail("Expected to throw an HabaneroDeveloperException");
            }
                //---------------Test Result -----------------------
            catch (HabaneroDeveloperException ex)
            {
                StringAssert.Contains("There was a problem creating a Habanero.Test.BO.OrganisationTestBO", ex.Message);
            }
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:24,代码来源:TestBusinessObjectCollection.cs

示例13: Test_CreateBusinessObject_AlternateClassDef

        public void Test_CreateBusinessObject_AlternateClassDef()
        {
            //---------------Set up test pack-------------------
            AddressTestBO addressTestBO = new AddressTestBO();

            ClassDef classDef = addressTestBO.ClassDef;
            ClassDef alternateClassDef = classDef.Clone();
            alternateClassDef.TypeParameter = TestUtil.GetRandomString();
            BusinessObjectCollection<AddressTestBO> addressCol = new BusinessObjectCollection<AddressTestBO> {ClassDef = alternateClassDef};

            //---------------Execute Test ----------------------

            //this should work because AddressTestBO has a constructor that takes a ClassDef as parameter
            AddressTestBO newCP = addressCol.CreateBusinessObject();

            //---------------Test Result -----------------------
            Assert.AreEqual(alternateClassDef, newCP.ClassDef);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:18,代码来源:TestBusinessObjectCollection.cs

示例14: Test_AddedEvent_NotFiringWhenRefreshing

        public void Test_AddedEvent_NotFiringWhenRefreshing()
        {
            //---------------Set up test pack-------------------
            ContactPersonTestBO.LoadDefaultClassDef();
            _addedEventFired = false;
            BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
            cpCol.LoadAll();
            ContactPersonTestBO newCP = cpCol.CreateBusinessObject();
            newCP.Surname = Guid.NewGuid().ToString();
            newCP.Save();

            cpCol.BusinessObjectAdded += delegate { _addedEventFired = true; };
            //---------------Assert Preconditions --------------
            Assert.IsFalse(_addedEventFired);

            //---------------Execute Test ----------------------
            cpCol.Refresh();
            //---------------Test Result -----------------------
            Assert.IsFalse(_addedEventFired);
        }
开发者ID:kevinbosman,项目名称:habanero,代码行数:20,代码来源:TestBusinessObjectCollection.cs

示例15: Test_CreatedBusinessObject_MarkForDelete_ShouldBeRemovedFromTheCollection

 public void Test_CreatedBusinessObject_MarkForDelete_ShouldBeRemovedFromTheCollection()
 {
     //---------------Set up test pack-------------------
     //ContactPersonTestBO.LoadDefaultClassDef();
     BusinessObjectCollection<ContactPersonTestBO> cpCol = new BusinessObjectCollection<ContactPersonTestBO>();
     ContactPersonTestBO newCP = cpCol.CreateBusinessObject();
     newCP.Surname = TestUtil.GetRandomString();
     //---------------Assert Precondition----------------
     AssertOneObjectInCurrentAndCreatedCollection(cpCol);
     //---------------Execute Test ----------------------
     newCP.MarkForDelete();
     //---------------Test Result -----------------------
     Assert.AreEqual(0, cpCol.Count);
     Assert.IsTrue(newCP.Status.IsDeleted);
 }
开发者ID:kevinbosman,项目名称:habanero,代码行数:15,代码来源:TestBusinessObjectCollection_CreateBO.cs


注:本文中的BusinessObjectCollection.CreateBusinessObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。