private static BusinessObjectCollection <OrganisationTestBO> GetClassDefs() { ClassDef.ClassDefs.Clear(); PersonTestBO.LoadDefaultClassDefWithTestOrganisationBOLookup(); ContactPersonTestBO.LoadDefaultClassDefWithPersonTestBOSuperClass(); return(CreateSavedOrganisationTestBOsCollection()); }
public void Test_ShowGridAndBOEditorControlWinWithSuperClassDef() { //--------------- Set up test pack ------------------ ClassDef.ClassDefs.Clear(); PersonTestBO.LoadDefaultClassDefWithTestOrganisationBOLookup(); ContactPersonTestBO.LoadDefaultClassDefWithPersonTestBOSuperClass(); BusinessObjectCollection <OrganisationTestBO> organisationTestBOs = CreateSavedOrganisationTestBOsCollection(); IControlFactory controlFactory = GetControlFactory(); ExtendedComboBoxWin extendedComboBox = new ExtendedComboBoxWin(controlFactory); const string propName = "OrganisationID"; ExtendedComboBoxMapper mapper = new ExtendedComboBoxMapper( extendedComboBox, propName, true, controlFactory); mapper.BusinessObject = new ContactPersonTestBO(); // mapper.RelatedBusinessObject = OrganisationTestBO.CreateSavedOrganisation(); //--------------- Test Preconditions ---------------- Assert.IsNull(mapper.PopupForm); //--------------- Execute Test ---------------------- //extendedComboBox.Button.PerformClick(); mapper.ShowPopupForm(); //--------------- Test Result ----------------------- Assert.IsNotNull(mapper.PopupForm); IFormHabanero form = mapper.PopupForm; Assert.AreEqual(800, form.Width); Assert.AreEqual(600, form.Height); Assert.AreEqual(1, form.Controls.Count); Assert.AreEqual(DockStyle.Fill, form.Controls[0].Dock); Assert.IsInstanceOf(typeof(IBOGridAndEditorControl), form.Controls[0]); Assert.IsInstanceOf(typeof(BOGridAndEditorControlWin), form.Controls[0]); BOGridAndEditorControlWin andBOGridAndEditorControlWin = (BOGridAndEditorControlWin)form.Controls[0]; //Assert.AreSame(mapper.BusinessObject, BOGridAndEditorControlWin.BOEditorControlWin.BusinessObject); Assert.IsTrue(andBOGridAndEditorControlWin.GridControl.IsInitialised); IBusinessObjectCollection collection = andBOGridAndEditorControlWin.GridControl.Grid.BusinessObjectCollection; Assert.IsNotNull(collection); Assert.AreEqual(organisationTestBOs.Count, collection.Count); Assert.AreEqual(organisationTestBOs.Count, mapper.LookupList.Count); }